{"record":{"id":"b9f66f20c8e08a38","repo":"emberjs/ember.js","slug":"attempted-to-call-compiletemplate-without-first","errorCode":null,"errorMessage":"Attempted to call `compileTemplate` without first loading the runtime template compiler.","messagePattern":"Attempted to call `compileTemplate` without first loading the runtime template compiler\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@ember/template-compilation/index.ts","lineNumber":25,"sourceCode":"// which makes that work. However, in practice it is supplied by the build,\n// *for* the build, and will *not* be present at runtime, so the actual value\n// here is `undefined` in prod; in dev it is a function which throws a somewhat\n// nicer error. This is janky, but... here we are.\ninterface PrecompileTemplate {\n  (\n    templateString: string,\n    options?: {\n      strictMode?: boolean;\n      scope?: () => Record<string, unknown>;\n      moduleName?: string;\n    }\n  ): TemplateFactory;\n}\n\nexport let __emberTemplateCompiler: undefined | typeof ETC;\nexport const compileTemplate: typeof ETC.compile = (...args: Parameters<typeof ETC.compile>) => {\n  if (!__emberTemplateCompiler) {\n    throw new Error(\n      'Attempted to call `compileTemplate` without first loading the runtime template compiler.'\n    );\n  }\n  return __emberTemplateCompiler.compile(...args);\n};\n\nexport let precompileTemplate: PrecompileTemplate;\n\nif (DEBUG) {\n  precompileTemplate = () => {\n    throw new Error(\n      'Attempted to call `precompileTemplate` at runtime, but this API is meant to be used at compile time. You should use `compileTemplate` instead.'\n    );\n  };\n}\n\nexport function __registerTemplateCompiler(c: typeof ETC) {\n  __emberTemplateCompiler = c;","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/emberjs/ember.js/blob/26f97246a8bf2e28edf26ac3093da2e86c04ffc5/packages/@ember/template-compilation/index.ts#L7-L43","documentation":"Error \"Attempted to call `compileTemplate` without first loading the runtime template compiler.\" thrown in emberjs/ember.js.","triggerScenarios":"Thrown at packages/@ember/template-compilation/index.ts:25 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"26f97246a8bf2e28edf26ac3093da2e86c04ffc5","analyzedAt":"2026-09-01T05:01:28.182Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}