Unknown prompt template
2 min read
The prompt constructor resolves a template by name from a registry and throws when the name is not present.
const templateName = config.template || 'default';
const template = this.templates.get(templateName);
if (!template) throw new Error(`Unknown template: ${templateName}`);
Why it does not fall back
Note that a default already applies when no template is requested. This error only fires when one was named and does not exist — and silently substituting the default there would be a different kind of wrong.
Templates shape what the planner is asked to produce. Asking for a specific one and quietly receiving another means the resulting plan was generated under instructions nobody chose, and nothing downstream records which template actually ran.
Templates are versioned artifacts
The registered templates carry version numbers. That matters more than it looks: a plan is a function of its inputs and the template that framed them, so comparing two plans generated months apart is only meaningful if you know whether the template changed between them.
Treating the template as a versioned artifact rather than an implementation detail is what makes that comparison possible.
How to fix it
Check the requested name against the registry. This is almost always a typo or a template that was renamed without updating its callers.
If you are adding one, register it before anything can request it — the registry is populated at construction, so a template added later than its first use fails here even though the code exists.
Adding one safely
Register the template at construction alongside the others, then reference it. The registry is populated once, so a template added after first use fails here even though the code for it exists — the error is about registration order, not about the template being missing from the codebase.
