{"record":{"id":"06a858079a1bd996","repo":"handlebars-lang/handlebars.js","slug":"the-partial-options-name-could-not-be-found","errorCode":null,"errorMessage":"The partial \"${options.name}\" could not be found","messagePattern":"The partial \"(.+?)\" could not be found","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"lib/handlebars/runtime.js","lineNumber":391,"sourceCode":"      options = {}\n    ) {\n      // Restore the partial-block from the closure for the execution of the block\n      // i.e. the part inside the block of the partial call.\n      options.data = createFrame(options.data);\n      options.data['partial-block'] = currentPartialBlock;\n      return fn(context, options);\n    };\n    if (fn.partials) {\n      options.partials = Utils.extend({}, options.partials, fn.partials);\n    }\n  }\n\n  if (partial === undefined && partialBlock) {\n    partial = partialBlock;\n  }\n\n  if (partial === undefined) {\n    throw new Exception(\n      'The partial \"' + options.name + '\" could not be found'\n    );\n  } else if (partial instanceof Function) {\n    return partial(context, options);\n  }\n}\n\nexport function noop() {\n  return '';\n}\n\nfunction initData(context, data) {\n  if (!data || !('root' in data)) {\n    data = data ? createFrame(data) : {};\n    data.root = context;\n  }\n  return data;\n}","sourceCodeStart":373,"sourceCodeEnd":409,"githubUrl":"https://github.com/handlebars-lang/handlebars.js/blob/13a7a679910d2adbfe7f6fad61ce8f98426b0378/lib/handlebars/runtime.js#L373-L409","documentation":"invokePartial throws when a partial referenced in a template ({{> myPartial}}) is not registered — Handlebars.lookupPartial returned undefined and no inline partial block exists. Handlebars requires every referenced partial to exist at render time.","triggerScenarios":"Calling render on a template containing {{> partialName}} where partialName was never passed to Handlebars.registerPartial, with no matching inline {{#> partialName}} block.","commonSituations":"Typos in partial names; forgetting to register partials in a new entry point; bundling only some precompiled partial files; partials defined only in tests/fixtures; inline partial blocks in a different template than the reference.","solutions":["Register the missing partial: Handlebars.registerPartial('partialName', templateOrString)","Verify the partial's precompiled file is loaded/included in the bundle before rendering","Fix the partial name typo in the {{> name}} reference"],"exampleFix":"// before\nconst t = Handlebars.compile('{{> header}}');\nt({}); // throws: partial \"header\" not found\n\n// after\nHandlebars.registerPartial('header', require('./header.precompiled.js'));\nt({});","handlingStrategy":"validation","validationCode":"function assertPartialsRegistered(templateSrc, handlebars) {\n  const names = [...templateSrc.matchAll(/\\{\\{>\\s*([\\w./-]+)/g)].map(m => m[1]);\n  for (const n of names) {\n    if (handlebars.partials[n] === undefined) {\n      throw new Error(`Partial \"${n}\" is not registered`);\n    }\n  }\n}","typeGuard":"function partialExists(handlebars, name) {\n  return handlebars.partials[name] !== undefined;\n}","tryCatchPattern":"try {\n  return template(data);\n} catch (e) {\n  if (/could not be found/.test(e.message) && /partial/.test(e.message)) {\n    // register the missing partial and retry once, or fail fast with context\n  } else throw e;\n}","preventionTips":["Register all partials in a shared bootstrap module imported before any render call","Keep partial names in a single constants/module list to avoid typos","Verify the precompiled partials file is included in every bundle/entry point","Smoke-test rendering of top-level templates in CI"],"tags":["handlebars","partials","missing-registration"],"backgroundTag":"partial-not-found","analyzedSha":"13a7a679910d2adbfe7f6fad61ce8f98426b0378","analyzedAt":"2026-09-02T20:25:07.518Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}