{"record":{"id":"6c4cb31515ead7d5","repo":"gohugoio/hugo","slug":"no-pageoutput","errorCode":null,"errorMessage":"no pageOutput","messagePattern":"no pageOutput","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/page.go","lineNumber":841,"sourceCode":"}\n\nfunc (ps *pageState) errorf(err error, format string, a ...any) error {\n\tif herrors.UnwrapFileError(err) != nil {\n\t\t// More isn't always better.\n\t\treturn err\n\t}\n\targs := append([]any{ps.Language().Lang, ps.pathOrTitle()}, a...)\n\targs = append(args, err)\n\tformat = \"[%s] page %q: \" + format + \": %w\"\n\tif err == nil {\n\t\treturn fmt.Errorf(format, args...)\n\t}\n\treturn fmt.Errorf(format, args...)\n}\n\nfunc (ps *pageState) outputFormat() (f output.Format) {\n\tif ps.pageOutput == nil {\n\t\tpanic(\"no pageOutput\")\n\t}\n\treturn ps.pageOutput.f\n}\n\nfunc (ps *pageState) parseError(err error, input []byte, offset int) error {\n\tpos := posFromInput(\"\", input, offset)\n\treturn herrors.NewFileErrorFromName(err, ps.File().Filename()).UpdatePosition(pos)\n}\n\nfunc (ps *pageState) pathOrTitle() string {\n\tif ps.File() != nil {\n\t\treturn ps.File().Filename()\n\t}\n\n\tif ps.Path() != \"\" {\n\t\treturn ps.Path()\n\t}\n","sourceCodeStart":823,"sourceCodeEnd":859,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/page.go#L823-L859","documentation":"Panic in pageState.outputFormat(): ps.pageOutput is nil when the output format is requested. pageOutput holds the current output-format-specific rendering state; a nil value means the page was never assigned an active output (e.g. it has no matching output format for the current site, or shiftToOutputFormat was not run).","triggerScenarios":"Requesting Permalink/RelPermalink/output format on a page whose pageOutput was never set, or whose output formats were all disabled/filtered out. A page rendered for an output format not in its outputs list. Accessing output-format-dependent fields before rendering begins.","commonSituations":"Configuring outputs to exclude a format that a template then references. A headless page accessed in a context expecting a published output. A render hook or shortcode run before the page's output is selected.","solutions":["Check the page's 'outputs' front matter / site outputs config includes the format you render for.","Avoid calling output-format-dependent methods on pages that may be headless or filtered; guard with IsPage/IsSection and output checks.","If embedding Hugo, ensure shiftToOutputFormat runs before consuming output.","Report a Hugo issue if a normal build hits this on a published page."],"exampleFix":"{{/* before: pageOutput nil for a format not in outputs */}}\n{{ .Permalink }}\n\n{{/* after: ensure outputs include the format, e.g. hugo.toml */}}\n[outputs]\nhome = ['html','rss']\npage = ['html']","handlingStrategy":"validation","validationCode":"// Ensure the page has an active output format before calling output-dependent methods.\n// hugo.toml: include the format in [outputs] for the page kind.\n// Templates: guard with {{ if .OutputFormats.Get \"html\" }} ... {{ end }} before Permalink.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep needed formats in the page's 'outputs' config.","Avoid output-format methods on headless pages.","Run shiftToOutputFormat before consuming output (embedded use).","Report stock-Hugo reproducers upstream."],"tags":["pages","output-formats","rendering","panic","internal-invariant"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}