{"record":{"id":"396c0114c0f9615e","repo":"gohugoio/hugo","slug":"render-w","errorCode":null,"errorMessage":"render: %w","messagePattern":"render: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/hugo_sites_build.go","lineNumber":198,"sourceCode":"\t\t\th.reportProgress(func() (state terminal.ProgressState, progress float64) {\n\t\t\t\treturn terminal.ProgressNormal, 0.20\n\t\t\t})\n\n\t\t\treturn nil\n\t\t}\n\n\t\tif prepareErr = prepare(); prepareErr != nil {\n\t\t\th.SendError(prepareErr)\n\t\t}\n\t}\n\n\tfor s := range h.allSites(nil) {\n\t\ts.state = siteStateReady\n\t}\n\n\tif prepareErr == nil {\n\t\tif err := h.render(infol, conf); err != nil {\n\t\t\th.SendError(fmt.Errorf(\"render: %w\", err))\n\t\t}\n\n\t\t// Make sure to write any build stats to disk first so it's available\n\t\t// to the post processors.\n\t\tif err := h.writeBuildStats(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// We need to do this before render deferred.\n\t\tif err := h.printPathWarningsOnce(); err != nil {\n\t\t\th.SendError(fmt.Errorf(\"printPathWarnings: %w\", err))\n\t\t}\n\n\t\tif err := h.renderDeferred(infol); err != nil {\n\t\t\th.SendError(fmt.Errorf(\"renderDeferred: %w\", err))\n\t\t}\n\n\t\t// This needs to be done after the deferred rendering to get complete template usage coverage.","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/hugo_sites_build.go#L180-L216","documentation":"Sent via SendError when the render() step fails. Rendering applies templates to assembled pages and writes output; the %w is the rendering error (template execution, output write, image processing, etc.).","triggerScenarios":"Raised at hugo_sites_build.go:198 when h.render(infol, conf) returns an error — template execution failures, output filesystem write errors, image/resource transform errors.","commonSituations":"A template referencing a missing method or nil value; output dir (public/) not writable or full; image processing (resize) failure on a corrupt image; a partial that errors only for specific pages.","solutions":["Unwrap %w and read the template name + line in the error context.","Fix the template (nil checks, correct method names, safeHTML where needed).","Ensure public/ is writable and the disk isn't full.","Re-process or replace corrupt images referenced by failing pages."],"exampleFix":"<!-- before -->\n<title>{{ .Title | upper }}</title>\n<!-- .Title nil on list page -> render error -->\n\n<!-- after -->\n<title>{{ with .Title }}{{ . | upper }}{{ end }}</title>","handlingStrategy":"try-catch","validationCode":"// Dry-run templates against sample pages with hugo --renderToMemory to catch render errors pre-build.","typeGuard":null,"tryCatchPattern":"if err := h.render(l, conf); err != nil {\n    // render errors carry template+line context; surface rather than swallow\n    h.SendError(fmt.Errorf(\"render: %w\", err))\n}","preventionTips":["Guard templates against nil values (with/ default).","Ensure public/ is writable and disk has space.","Validate images referenced by content are non-corrupt."],"tags":["build","rendering","templates","output","hugo"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}