santifer/career-ops · error
Template not found for kind=
Error message
Template not found for kind=${kind} name=${chosen} (${fileFor(chosen)}) What it means
Template resolution failure in cv-templates.mjs: the requested (or profile-defaulted) template name, kebab-cased as `chosen`, does not match any template discovered for that kind — neither the flat `${prefix}.${name}.${format}` file nor a pack containing it. Because resolution goes through the same discovery as listTemplates, the name is provably absent rather than merely unlisted; the interpolated text names the kind, the name tried, and the flat filename it would have mapped to. A missing/typo'd explicit name or a stale profile default both land here.
Solutions
- List available templates for the kind to see valid names
- Fix the typo or casing in the explicitly requested template name
- If no name was passed, fix the profile's template default — the fallback 'standard' always resolves
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cv-templates.mjs:263 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16).
Data as JSON: /api/errors/3fc81c61b435c4fb.
Report an issue: GitHub.
Appendix: source
Thrown at cv-templates.mjs:263
const explicit = Boolean(name && String(name).trim());
let chosen = kebab(explicit ? name : loadProfileDefault(kind, { profilePath }) || 'standard');
const fileFor = (n) => (n === 'standard' ? `${cfg.prefix}.${format}` : `${cfg.prefix}.${n}.${format}`);
// Resolution goes through the same discovery as listTemplates, so a name that
// lists is a name that resolves. Constructing `dir/fileFor(chosen)` directly
// would find flat templates only: a pack would list fine and then throw here,
// which is the failure mode that passes review because the demo path works.
// Every by-name caller lands here — build-cv-latex.mjs, generate-cover-letter.mjs.
const found = discover(kind, { dir, format });
let entry = found.get(chosen);
if (!entry && fallback && chosen !== 'standard') {
chosen = 'standard';
entry = found.get(chosen);
}
if (!entry) {
throw new Error(`Template not found for kind=${kind} name=${chosen} (${fileFor(chosen)})`);
}
const path = entry.path;
if (format === 'html') {
const v = validateTemplate(path, kind);
if (!v.ok) {
// Name the file that is actually short, not the flat filename it would
// have had. For a pack these differ, and the flat name points at nothing.
const where = entry.pack ? `${entry.pack}/${fileFor(chosen)}` : fileFor(chosen);
throw new Error(
`Template ${where} missing required placeholders: ${v.missing.map((m) => `{{${m}}}`).join(', ')}`
);
}
}
return path;
}
// ---- CLI ----
const isMain = isMainModule(import.meta.url);View on GitHub (pinned to aac998c7ed)