{"record":{"id":"620c048466d13eff","repo":"gohugoio/hugo","slug":"s-page-q-format-w","errorCode":null,"errorMessage":"[%s] page %q: \" + format + \": %w","messagePattern":"\\[(.+?)\\] page %q: \" \\+ format \\+ \": %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/page.go","lineNumber":836,"sourceCode":"\n\tif err != nil {\n\t\tps.s.Log.Errorln(\"Failed to create content converter:\", err)\n\t}\n\treturn ps.contentConverter\n}\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}","sourceCodeStart":818,"sourceCodeEnd":854,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/page.go#L818-L854","documentation":"The canonical page-error formatter, pageState.errorf (page.go:832-836). It prepends the language code and page path/title to a caller-supplied message and the wrapped %w, producing '[lang] page \"path/title\": <msg>: <cause>'. It is the shared shape for most human-facing per-page errors, so the 'message' you see is dynamically built from the format string each call site passes.","triggerScenarios":"Any code path that calls ps.errorf(err, format, args...) — typically content-converter failures, render errors, or resource errors that should be reported with full page context. The actual tail text depends on the call site's format string.","commonSituations":"Failed markup conversion (asciidoc/org/pandoc external converter missing), render errors tied to a specific page, or resource resolution failures on a page. Treat the bracketed lang + page as the locator and the trailing text as the real cause.","solutions":["Use the [lang] page \"...\" prefix to locate the offending content file.","Act on the trailing message/cause (e.g. install a missing markup converter, fix the template).","If the cause is a wrapped file-position error, open the file at the noted line/col."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := ps.errorf(cause, \"convert %q\", markup); err != nil {\n    // message shaped '[lang] page \"path\": convert \"md\": <cause>'\n}","preventionTips":["Install external markup converters the page references.","Keep page templates/shortcodes consistent with the current Hugo API."],"tags":["page","error-context","format","converter"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}