{"id":"471b56452300a77d","repo":"gohugoio/hugo","slug":"template-q-not-found","errorCode":null,"errorMessage":"template %q not found","messagePattern":"template %q not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/page__per_output.go","lineNumber":117,"sourceCode":"\tif pco == nil {\n\t\treturn\n\t}\n\tpco.contentRenderedVersion++\n\tpco.contentRendered.Store(false)\n\tpco.renderHooks = &renderHooks{}\n}\n\nfunc (pco *pageContentOutput) Render(ctx context.Context, layout ...string) (template.HTML, error) {\n\tif len(layout) == 0 {\n\t\treturn \"\", errors.New(\"no layout given\")\n\t}\n\ttempl, found, err := pco.po.p.resolveTemplate(layout...)\n\tif err != nil {\n\t\treturn \"\", pco.po.p.wrapError(err)\n\t}\n\n\tif !found {\n\t\treturn \"\", fmt.Errorf(\"template %q not found\", layout[0])\n\t}\n\n\t// Make sure to send the *pageState and not the *pageContentOutput to the template.\n\tres, err := executeToString(ctx, pco.po.p.s.GetTemplateStore(), templ, pco.po.p)\n\tif err != nil {\n\t\treturn \"\", pco.po.p.wrapError(fmt.Errorf(\"failed to execute template %s: %w\", templ.Name(), err))\n\t}\n\treturn template.HTML(res), nil\n}\n\nfunc (pco *pageContentOutput) Fragments(ctx context.Context) *tableofcontents.Fragments {\n\treturn pco.c().Fragments(ctx)\n}\n\nfunc (pco *pageContentOutput) RenderShortcodes(ctx context.Context) (template.HTML, error) {\n\treturn pco.c().RenderShortcodes(ctx)\n}\n","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/hugolib/page__per_output.go#L99-L135","documentation":"Returned by pageContentOutput.Render when resolveTemplate finds no template matching the requested layout name for the page's type, kind, and output format. The `.Render \"name\"` template call requires a corresponding layout file (e.g. layouts/summary.html or layouts/<section>/summary.html); if lookup succeeds with no error but no match, Hugo reports the first requested layout name as not found.","triggerScenarios":"`{{ .Render \"summary\" }}` when no summary.html exists anywhere in the layout lookup chain (project layouts, theme, module mounts) for that page's section/type/output format.","commonSituations":"Theme not installed or module not mounted so its layouts are missing, typo in the layout name, layout placed under an old path the current lookup rules no longer honor (e.g. layouts/_default/ in configs targeting the new layout system), or rendering to a non-HTML output format lacking that layout.","solutions":["Create the layout file the name refers to, e.g. layouts/summary.html (or layouts/<type>/summary.html), using the current Hugo layout conventions.","Check the theme/module is actually enabled (theme setting or module imports) so its layouts are on the lookup path.","Verify the name passed to .Render matches the file name exactly, and that a variant exists for the page's output format.","Run `hugo --printPathWarnings` / check `hugo config mounts` to confirm layouts are mounted where expected."],"exampleFix":"<!-- template calls {{ .Render \"li\" }} -->\n<!-- fix: add layouts/li.html -->\n<li><a href=\"{{ .RelPermalink }}\">{{ .Title }}</a></li>","handlingStrategy":"validation","validationCode":"{{/* In templates, guard explicit template lookups */}}\n{{ with .Page.Layout }}{{ if not (templates.Exists (printf \"layouts/%s.html\" .)) }}{{ errorf \"layout %q missing\" . }}{{ end }}{{ end }}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["If front matter sets layout: foo, ensure layouts/foo.html (or the type-scoped variant) exists","Use current layout paths (layouts/page.html, not layouts/_default/single.html) per the latest spec","Check theme + project layouts merge order; a theme upgrade can remove a template you referenced"],"tags":["hugo","templates","layouts","lookup"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}