Scope the resolution of a template with a model element for proper error reporting