eyaltoledano/claude-task-master · error

Template "${templateName}" not found

Error message

Template "${templateName}" not found

What it means

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.

Source

Thrown at packages/tm-core/src/modules/git/services/template-engine.ts:76

		};
		this.preservePlaceholders = options.preservePlaceholders ?? false;
	}

	/**
	 * Render a template with provided variables
	 */
	render(
		templateName: string,
		variables: TemplateVariables,
		inlineTemplate?: string
	): string {
		const template =
			inlineTemplate !== undefined
				? inlineTemplate
				: this.templates[templateName];

		if (template === undefined) {
			throw new Error(`Template "${templateName}" not found`);
		}

		return this.substituteVariables(template, variables);
	}

	/**
	 * Set or update a template
	 */
	setTemplate(name: string, template: string): void {
		this.templates[name] = template;
	}

	/**
	 * Get a template by name
	 */
	getTemplate(name: string): string | undefined {
		return this.templates[name];
	}

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Check the exact registered template name and fix the spelling
  2. Register the missing template before calling render
  3. Pass an inline template string as the inlineTemplate parameter to avoid registry lookup

Example fix

// before
await engine.render('comit-message', vars); // typo, throws
// after
await engine.render('commit-message', vars);
Defensive patterns

Strategy: validation

Validate before calling

if (inlineTemplate === undefined && !(templateName in engine.templates)) {
  throw new Error(`Template not registered: ${templateName}`);
}

Type guard

null

Try / catch

try {
  const msg = await engine.render(name, vars);
} catch (e) {
  if ((e as Error).message.includes('not found')) {
    const msg = await engine.render('default', vars); // fallback template
  }
}

Prevention

When it happens

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

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

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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