{"record":{"id":"3fc81c61b435c4fb","repo":"santifer/career-ops","slug":"template-not-found-for-kind-kind-name-chosen","errorCode":null,"errorMessage":"Template not found for kind=${kind} name=${chosen} (${fileFor(chosen)})","messagePattern":"Template not found for kind=(.+?) name=(.+?) \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cv-templates.mjs","lineNumber":263,"sourceCode":"\n  const explicit = Boolean(name && String(name).trim());\n  let chosen = kebab(explicit ? name : loadProfileDefault(kind, { profilePath }) || 'standard');\n  const fileFor = (n) => (n === 'standard' ? `${cfg.prefix}.${format}` : `${cfg.prefix}.${n}.${format}`);\n\n  // Resolution goes through the same discovery as listTemplates, so a name that\n  // lists is a name that resolves. Constructing `dir/fileFor(chosen)` directly\n  // would find flat templates only: a pack would list fine and then throw here,\n  // which is the failure mode that passes review because the demo path works.\n  // Every by-name caller lands here — build-cv-latex.mjs, generate-cover-letter.mjs.\n  const found = discover(kind, { dir, format });\n\n  let entry = found.get(chosen);\n  if (!entry && fallback && chosen !== 'standard') {\n    chosen = 'standard';\n    entry = found.get(chosen);\n  }\n  if (!entry) {\n    throw new Error(`Template not found for kind=${kind} name=${chosen} (${fileFor(chosen)})`);\n  }\n  const path = entry.path;\n  if (format === 'html') {\n    const v = validateTemplate(path, kind);\n    if (!v.ok) {\n      // Name the file that is actually short, not the flat filename it would\n      // have had. For a pack these differ, and the flat name points at nothing.\n      const where = entry.pack ? `${entry.pack}/${fileFor(chosen)}` : fileFor(chosen);\n      throw new Error(\n        `Template ${where} missing required placeholders: ${v.missing.map((m) => `{{${m}}}`).join(', ')}`\n      );\n    }\n  }\n  return path;\n}\n\n// ---- CLI ----\nconst isMain = isMainModule(import.meta.url);","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/cv-templates.mjs#L245-L281","documentation":"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.","triggerScenarios":"Thrown at cv-templates.mjs:263 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"aac998c7ed7248ea853b720ceeb1fdbeb322fc5d","analyzedAt":"2026-09-16T06:35:29.214Z","contentChangedAt":"2026-09-16T06:35:29.214Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}