eyaltoledano/claude-task-master · error

Prompt template '${promptId}' not found

Error message

Prompt template '${promptId}' not found

What it means

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.

Source

Thrown at scripts/modules/prompt-manager.js:134

			this.cache.set(cacheKey, rendered);

			return rendered;
		} catch (error) {
			log('error', `Failed to load prompt ${promptId}: ${error.message}`);
			throw error;
		}
	}

	/**
	 * Load a prompt template from the imported prompts
	 * @private
	 */
	loadTemplate(promptId) {
		// Get template from the map
		const template = this.prompts.get(promptId);

		if (!template) {
			throw new Error(`Prompt template '${promptId}' not found`);
		}

		// Schema validation if available (do this first for detailed errors)
		if (this.validatePrompt && this.validatePrompt !== true) {
			const valid = this.validatePrompt(template);
			if (!valid) {
				const errors = this.validatePrompt.errors
					.map((err) => `${err.instancePath || 'root'}: ${err.message}`)
					.join(', ');
				throw new Error(`Schema validation failed: ${errors}`);
			}
		} else {
			// Fallback basic validation if no schema validation available
			if (!template.id || !template.prompts || !template.prompts.default) {
				throw new Error(
					'Invalid template structure: missing required fields (id, prompts.default)'
				);
			}

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Check the exact registered ID (case-sensitive) and correct the spelling.
  2. Ensure PromptManager initialization loaded/registered the prompt files before template() is called.
  3. Add the missing template with the manager's registration method before use.
  4. After upgrading, verify renamed template IDs and update call sites accordingly.

Example fix

// before
const tpl = promptManager.template('task-uptate');
// after
const tpl = promptManager.template('task-update');
Defensive patterns

Strategy: validation

Validate before calling

function hasTemplate(manager, promptId) {
  const registry = manager.prompts instanceof Map ? manager.prompts : null;
  if (registry && !registry.has(promptId)) {
    throw new Error(`Unknown promptId '${promptId}'. Available: ${[...registry.keys()].join(', ')}`);
  }
  return true;
}

Try / catch

try {
  const tpl = promptManager.template(promptId);
} catch (e) {
  if (e.message.includes('not found')) {
    console.warn(`Template '${promptId}' missing; falling back to default`);
    return promptManager.template('default-template-id');
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/6da5205ec92e18c9. Report an issue: GitHub.