{"id":"f559b9d373cd4280","repo":"gohugoio/hugo","slug":"partial-q-not-found","errorCode":null,"errorMessage":"partial %q not found","messagePattern":"partial %q not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tpl/partials/partials.go","lineNumber":140,"sourceCode":"}\n\nfunc (ns *Namespace) include(ctx context.Context, name string, dataList ...any) includeResult {\n\tv, err := ns.lookup(name)\n\tif err != nil {\n\t\treturn includeResult{err: err}\n\t}\n\treturn ns.doInclude(ctx, \"\", v, dataList...)\n}\n\nfunc (ns *Namespace) lookup(name string) (*tplimpl.TemplInfo, error) {\n\tif strings.HasPrefix(name, \"partials/\") {\n\t\t// This is most likely not what the user intended.\n\t\t// This worked before Hugo 0.146.0.\n\t\tns.deps.Log.Warnidf(constants.WarnPartialSuperfluousPrefix, \"Doubtful use of partial function in {{ partial \\\"%s\\\"}}), this is most likely not what you want. Consider removing superfluous prefix \\\"partials/\\\" from template name given as first function argument.\", name)\n\t}\n\tv := ns.deps.TemplateStore.LookupPartial(name)\n\tif v == nil {\n\t\treturn nil, fmt.Errorf(\"partial %q not found\", name)\n\t}\n\treturn v, nil\n}\n\n// include is a helper function that lookups and executes the named partial.\n// Returns the final template name and the rendered output.\nfunc (ns *Namespace) doInclude(ctx context.Context, key string, templ *tplimpl.TemplInfo, dataList ...any) includeResult {\n\tif templ.ParseInfo.HasPartialInner {\n\t\tstack := tpl.Context.PartialDecoratorIDStack.Get(ctx)\n\t\tif stack != nil {\n\t\t\tif id, ok := stack.Peek(); ok {\n\t\t\t\t// Signal that inner exists.\n\t\t\t\tid.Bool = true\n\t\t\t}\n\t\t}\n\t}\n\tvar data any\n\tif len(dataList) > 0 {","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/tpl/partials/partials.go#L122-L158","documentation":"Raised by the partials namespace lookup (tpl/partials/partials.go:140) when `partial` or `partialCached` is called with a name that `TemplateStore.LookupPartial` cannot resolve. Hugo looks partials up relative to `layouts/_partials/` (formerly `layouts/partials/`); if no template exists under that name, rendering fails with this error.","triggerScenarios":"`{{ partial \"foo.html\" . }}` or `{{ partialCached \"foo.html\" . }}` where `layouts/_partials/foo.html` (or a theme/module equivalent) does not exist; a typo in the name; wrong subdirectory path; or a missing file extension when one is required.","commonSituations":"Typos or case mismatches in the partial name (case matters on Linux/CI but not macOS), forgetting the theme or module that supplies the partial in `theme`/module imports, migrating to Hugo ≥ 0.146 where the layouts layout changed, or writing `partials/foo.html` as the argument — the code explicitly warns that the `partials/` prefix is superfluous and usually wrong.","solutions":["Verify the file exists at `layouts/_partials/<name>` (or `layouts/partials/` in older setups), matching case exactly.","Remove any superfluous `partials/` prefix from the call: use `{{ partial \"foo.html\" . }}`, not `{{ partial \"partials/foo.html\" . }}`.","If the partial comes from a theme or module, confirm the theme/module is listed in your site config and vendored/fetched (`hugo mod get`).","Run `hugo --printPathWarnings` or check the site with `hugo server` to see lookup warnings."],"exampleFix":"<!-- before -->\n{{ partial \"partials/head.html\" . }}\n<!-- after: file at layouts/_partials/head.html -->\n{{ partial \"head.html\" . }}","handlingStrategy":"validation","validationCode":"{{ if templates.Exists (printf \"partials/%s\" $name) }}\n  {{ partial $name . }}\n{{ else }}\n  {{ warnf \"partial %q missing\" $name }}\n{{ end }}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Guard dynamic partial names with templates.Exists before calling partial","Keep partial paths relative to layouts/partials/ and include the file extension if the file has one","Verify theme-provided partials exist when overriding or upgrading a theme","Avoid constructing partial names from user content without a whitelist"],"tags":["hugo","templates","partials","lookup"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}