{"record":{"id":"6da5205ec92e18c9","repo":"eyaltoledano/claude-task-master","slug":"prompt-template-promptid-not-found","errorCode":null,"errorMessage":"Prompt template '${promptId}' not found","messagePattern":"Prompt template '(.+?)' not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/modules/prompt-manager.js","lineNumber":134,"sourceCode":"\t\t\tthis.cache.set(cacheKey, rendered);\n\n\t\t\treturn rendered;\n\t\t} catch (error) {\n\t\t\tlog('error', `Failed to load prompt ${promptId}: ${error.message}`);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Load a prompt template from the imported prompts\n\t * @private\n\t */\n\tloadTemplate(promptId) {\n\t\t// Get template from the map\n\t\tconst template = this.prompts.get(promptId);\n\n\t\tif (!template) {\n\t\t\tthrow new Error(`Prompt template '${promptId}' not found`);\n\t\t}\n\n\t\t// Schema validation if available (do this first for detailed errors)\n\t\tif (this.validatePrompt && this.validatePrompt !== true) {\n\t\t\tconst valid = this.validatePrompt(template);\n\t\t\tif (!valid) {\n\t\t\t\tconst errors = this.validatePrompt.errors\n\t\t\t\t\t.map((err) => `${err.instancePath || 'root'}: ${err.message}`)\n\t\t\t\t\t.join(', ');\n\t\t\t\tthrow new Error(`Schema validation failed: ${errors}`);\n\t\t\t}\n\t\t} else {\n\t\t\t// Fallback basic validation if no schema validation available\n\t\t\tif (!template.id || !template.prompts || !template.prompts.default) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Invalid template structure: missing required fields (id, prompts.default)'\n\t\t\t\t);\n\t\t\t}","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/prompt-manager.js#L116-L152","documentation":"Thrown by PromptManager.loadTemplate when the requested promptId has no registered template in the internal prompts map. The manager only serves templates that were registered (or loaded) beforehand, so an unknown ID means the template was never added or the ID is misspelled.","triggerScenarios":"Calling promptManager.template('some-id') / loadTemplate('some-id') where 'some-id' was never registered via addPrompt/register, loaded from a missing prompt file, or where the ID string casing differs from the registered key.","commonSituations":"Typos in the prompt ID, prompts directory not loaded before use (initialization skipped), custom templates removed/renamed in a version upgrade, or referencing a template from another project/config that was never installed.","solutions":["Check the exact registered ID (case-sensitive) and correct the spelling.","Ensure PromptManager initialization loaded/registered the prompt files before template() is called.","Add the missing template with the manager's registration method before use.","After upgrading, verify renamed template IDs and update call sites accordingly."],"exampleFix":"// before\nconst tpl = promptManager.template('task-uptate');\n// after\nconst tpl = promptManager.template('task-update');","handlingStrategy":"validation","validationCode":"function hasTemplate(manager, promptId) {\n  const registry = manager.prompts instanceof Map ? manager.prompts : null;\n  if (registry && !registry.has(promptId)) {\n    throw new Error(`Unknown promptId '${promptId}'. Available: ${[...registry.keys()].join(', ')}`);\n  }\n  return true;\n}","typeGuard":null,"tryCatchPattern":"try {\n  const tpl = promptManager.template(promptId);\n} catch (e) {\n  if (e.message.includes('not found')) {\n    console.warn(`Template '${promptId}' missing; falling back to default`);\n    return promptManager.template('default-template-id');\n  }\n  throw e;\n}","preventionTips":["List registered prompt IDs once at startup and validate config references against it.","Keep prompt IDs in a constants module instead of inline strings.","Ensure PromptManager initialization/loading runs before any template() call.","Re-check template names after version upgrades."],"tags":["templates","prompts","key-not-found","configuration"],"backgroundTag":"template-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}