{"record":{"id":"2630747306bd7852","repo":"can1357/oh-my-pi","slug":"the-partial-node-expression-name-could-not-be-f","errorCode":null,"errorMessage":"The partial ${node.expression.name} could not be found","messagePattern":"The partial (.+?) could not be found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/utils/src/template.ts","lineNumber":506,"sourceCode":"\t}\n\tif (name === \"with\")\n\t\treturn isConditionalTruthy(value)\n\t\t\t? renderNodes(node.body, childFrame(frame, value), evaluation)\n\t\t\t: renderNodes(node.inverse, frame, evaluation);\n\tconst resolved = resolvePath(name, frame);\n\tif (Array.isArray(resolved))\n\t\treturn (\n\t\t\tresolved.map(item => renderNodes(node.body, childFrame(frame, item), evaluation)).join(\"\") ||\n\t\t\trenderNodes(node.inverse, frame, evaluation)\n\t\t);\n\treturn resolved === false || resolved == null\n\t\t? renderNodes(node.inverse, frame, evaluation)\n\t\t: renderNodes(node.body, childFrame(frame, resolved), evaluation);\n}\n\nfunction renderPartial(node: PartialNode, frame: Frame, evaluation: Evaluation): string {\n\tconst partial = evaluation.runtime.partials?.[node.expression.name] ?? evaluation.partials.get(node.expression.name);\n\tif (partial === undefined) throw new Error(`The partial ${node.expression.name} could not be found`);\n\tconst context = node.expression.args.length\n\t\t? evaluateExpression(node.expression.args[0], frame, evaluation)\n\t\t: frame.context;\n\tconst hash = evaluateHash(node.expression.hash, frame, evaluation);\n\tconst merged =\n\t\thash && context && typeof context === \"object\" ? { ...(context as Record<string, unknown>), ...hash } : context;\n\treturn typeof partial === \"function\"\n\t\t? partial(merged, evaluation.runtime)\n\t\t: compile(partial, evaluation.options)(merged, evaluation.runtime);\n}\n\nfunction stringify(value: unknown, shouldEscape: boolean): string {\n\tif (value == null) return \"\";\n\tif (value instanceof SafeString) return value.toString();\n\tconst text = String(value);\n\treturn shouldEscape ? escapeExpression(text) : text;\n}\n","sourceCodeStart":488,"sourceCodeEnd":524,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/utils/src/template.ts#L488-L524","documentation":"renderPartial() resolves a partial by name from the runtime partials (`runtime.partials`) and the render-time partials map. If neither contains the name referenced by `{{> partialName}}`, it throws \"The partial <name> could not be found\" — Handlebars-compatible behavior.","triggerScenarios":"Rendering a template with `{{> header}}` (or `{{>header ctx}}`) where `header` was not supplied via the partials option/map used for this render.","commonSituations":"Templates referencing project partials while rendering through an entry point that doesn't load the partials directory; a rename of the partial file without updating `{{> ...}}` references; per-render partials maps that only include some partials; nesting partials that reference siblings not passed down.","solutions":["Pass the partial in the render options: `{ partials: { header: '<header>...</header>' } }`.","Fix the template to reference the correct partial name (check casing — the lookup is exact).","If partials are loaded from a directory, ensure the loader registers all files before rendering."],"exampleFix":"// before\nrender('{{> header}}', data);\n// after\nrender('{{> header}}', data, { partials: { header: '<h1>{{title}}</h1>' } });","handlingStrategy":"validation","validationCode":"function assertPartialsAvailable(src, partials = {}, runtimePartials = {}) {\n  const names = new Set();\n  for (const t of src.match(/\\{\\{>\\s*[^}\\s]+/g) ?? []) {\n    names.add(t.replace(/^\\{\\{>\\s*/, ''));\n  }\n  const missing = [...names].filter(n => !(n in partials) && !(n in runtimePartials));\n  if (missing.length) throw new Error(`Missing partials referenced by template: ${missing.join(', ')}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  return render(src, data, { partials });\n} catch (err) {\n  const m = /^The partial (.+) could not be found$/.exec(err?.message ?? '');\n  if (m) throw new Error(`Register partial \"${m[1]}\" in the partials option before rendering`);\n  throw err;\n}","preventionTips":["Load and register the whole partials directory once and reuse that map for every render.","Rename partial files together with their `{{> ...}}` references (find-replace across templates).","Keep partial name casing consistent — lookups are exact matches."],"tags":["template","handlebars","partials"],"backgroundTag":"partial-not-found","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}