{"record":{"id":"e0455fce409ae6d5","repo":"eyaltoledano/claude-task-master","slug":"template-templatename-not-found","errorCode":null,"errorMessage":"Template \"${templateName}\" not found","messagePattern":"Template \"(.+?)\" not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/git/services/template-engine.ts","lineNumber":76,"sourceCode":"\t\t};\n\t\tthis.preservePlaceholders = options.preservePlaceholders ?? false;\n\t}\n\n\t/**\n\t * Render a template with provided variables\n\t */\n\trender(\n\t\ttemplateName: string,\n\t\tvariables: TemplateVariables,\n\t\tinlineTemplate?: string\n\t): string {\n\t\tconst template =\n\t\t\tinlineTemplate !== undefined\n\t\t\t\t? inlineTemplate\n\t\t\t\t: this.templates[templateName];\n\n\t\tif (template === undefined) {\n\t\t\tthrow new Error(`Template \"${templateName}\" not found`);\n\t\t}\n\n\t\treturn this.substituteVariables(template, variables);\n\t}\n\n\t/**\n\t * Set or update a template\n\t */\n\tsetTemplate(name: string, template: string): void {\n\t\tthis.templates[name] = template;\n\t}\n\n\t/**\n\t * Get a template by name\n\t */\n\tgetTemplate(name: string): string | undefined {\n\t\treturn this.templates[name];\n\t}","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/git/services/template-engine.ts#L58-L94","documentation":"TemplateEngine.render throws this when neither an inline template nor a registered template under templateName exists. Templates are stored in the engine's internal templates map, so the requested name must have been registered beforehand.","triggerScenarios":"Calling render(templateName, variables) (from generateMessage or directly) with a templateName key that was never registered via the engine's template registration API, a typo'd name, or where the inline template argument is omitted/undefined.","commonSituations":"Typos in template names ('default ' vs 'default'), renaming templates without updating call sites, loading templates from config files where the entry is missing, or expecting built-in templates that aren't registered in this instance.","solutions":["Check the exact registered template name and fix the spelling","Register the missing template before calling render","Pass an inline template string as the inlineTemplate parameter to avoid registry lookup"],"exampleFix":"// before\nawait engine.render('comit-message', vars); // typo, throws\n// after\nawait engine.render('commit-message', vars);","handlingStrategy":"validation","validationCode":"if (inlineTemplate === undefined && !(templateName in engine.templates)) {\n  throw new Error(`Template not registered: ${templateName}`);\n}","typeGuard":"null","tryCatchPattern":"try {\n  const msg = await engine.render(name, vars);\n} catch (e) {\n  if ((e as Error).message.includes('not found')) {\n    const msg = await engine.render('default', vars); // fallback template\n  }\n}","preventionTips":["Keep template names in a shared constants file instead of string literals","Register templates at startup and validate required names in config loading","Add a smoke test that renders every registered template name used in call sites"],"tags":["template","configuration","lookup"],"backgroundTag":"resource-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}