emberjs/ember.js · error · Error
Compile Error: ${template.problem} @ ${template.span.start}.
Error message
Compile Error: ${template.problem} @ ${template.span.start}..${template.span.end} What it means
unwrapTemplate asserts the template compiled successfully; if the template's compile result is an error, it throws with the compiler's problem and source span. It converts a lazy compile failure into an immediate, descriptive error.
Source
Thrown at packages/@ember/-internals/glimmer/lib/component-managers/unwrap-template.ts:8
import type { Template, TemplateOk } from '@glimmer/interfaces';
/**
* @deprecated
*/
export function unwrapTemplate(template: Template): TemplateOk {
if (template.result === 'error') {
throw new Error(
`Compile Error: ${template.problem} @ ${template.span.start}..${template.span.end}`
);
}
return template;
}
View on GitHub (pinned to 26f97246a8)
Solutions
- Fix the template syntax error reported in `problem` at the given span
- Rebuild (ember build/serve) to clear stale compilation artifacts
- If compiling templates at runtime, validate/compile with setTemplate/compile first and handle errors
- Check the addon providing the dynamic layout for version compatibility
Example fix
// before
{{#if this.user
<p>hi</p>
{{/if}}
// after
{{#if this.user}}
<p>hi</p>
{{/if}} Defensive patterns
Strategy: try-catch
Validate before calling
if (template && template.result === 'error') { console.error(template.problem, template.span); } Type guard
function isTemplateOk(t) { return t && t.result === 'ok'; } Try / catch
try { tpl = unwrapTemplate(template); } catch (e) { if (String(e.message).startsWith('Compile Error:')) { report(template.problem, template.span); } throw e; } Prevention
- Lint templates (ember-template-lint) in CI
- Fix compile errors reported by the build before runtime
- Validate runtime-compiled templates
- Keep template compiler and ember-source versions aligned
When it happens
Trigger: Passing a template object whose compilation failed (syntax error in a handlebars/glimmer template) into unwrapTemplate via templateFor, getDynamicLayout, or component construction with a dynamic layout.
Common situations: Typo in handlebars syntax (unclosed block, bad {{#if}}), invalid component layout strings, build pipeline producing error template results, runtime-compiled templates from addon code.
Related errors
- You can only `once`, `passive` or `capture` named arguments
- A resolved helper cannot be passed as a named argument as th
- deprecation override for ${id} not found
- You must pass both the owner and args to super() in your com
- You must pass both the owner and args to super() in your com
AI-assisted analysis of emberjs/ember.js@26f97246a8 (2026-09-01).
Data as JSON: /api/errors/5b23fe6cb290a883.
Report an issue: GitHub.