{"record":{"id":"5b23fe6cb290a883","repo":"emberjs/ember.js","slug":"compile-error-template-problem-template-sp","errorCode":null,"errorMessage":"Compile Error: ${template.problem} @ ${template.span.start}..${template.span.end}","messagePattern":"Compile Error: (.+?) @ (.+?)\\.\\.(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@ember/-internals/glimmer/lib/component-managers/unwrap-template.ts","lineNumber":8,"sourceCode":"import type { Template, TemplateOk } from '@glimmer/interfaces';\n\n/**\n * @deprecated\n */\nexport function unwrapTemplate(template: Template): TemplateOk {\n  if (template.result === 'error') {\n    throw new Error(\n      `Compile Error: ${template.problem} @ ${template.span.start}..${template.span.end}`\n    );\n  }\n\n  return template;\n}\n","sourceCodeStart":1,"sourceCodeEnd":15,"githubUrl":"https://github.com/emberjs/ember.js/blob/26f97246a8bf2e28edf26ac3093da2e86c04ffc5/packages/@ember/-internals/glimmer/lib/component-managers/unwrap-template.ts#L1-L15","documentation":"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.","triggerScenarios":"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.","commonSituations":"Typo in handlebars syntax (unclosed block, bad {{#if}}), invalid component layout strings, build pipeline producing error template results, runtime-compiled templates from addon code.","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"],"exampleFix":"// before\n{{#if this.user\n  <p>hi</p>\n{{/if}}\n// after\n{{#if this.user}}\n  <p>hi</p>\n{{/if}}","handlingStrategy":"try-catch","validationCode":"if (template && template.result === 'error') { console.error(template.problem, template.span); }","typeGuard":"function isTemplateOk(t) { return t && t.result === 'ok'; }","tryCatchPattern":"try { tpl = unwrapTemplate(template); } catch (e) { if (String(e.message).startsWith('Compile Error:')) { report(template.problem, template.span); } throw e; }","preventionTips":["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"],"tags":["ember","glimmer","template","compile-error"],"backgroundTag":"template-compile-error","analyzedSha":"26f97246a8bf2e28edf26ac3093da2e86c04ffc5","analyzedAt":"2026-09-01T05:01:28.182Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}