{"record":{"id":"265885dc4a5b70b6","repo":"gohugoio/hugo","slug":"logged-d-error-s","errorCode":null,"errorMessage":"logged %d error(s)","messagePattern":"logged (.+?) error\\(s\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/hugo_sites_build.go","lineNumber":247,"sourceCode":"\n\t\th.Log.Printf(\"\\nTemplate Metrics:\\n\\n\")\n\t\th.Log.Println(b.String())\n\t}\n\n\th.StopErrorCollector()\n\n\terr := <-errs\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := h.fatalErrorHandler.getErr(); err != nil {\n\t\treturn err\n\t}\n\n\terrorCount := h.Log.LoggCount(logg.LevelError) + loggers.Log().LoggCount(logg.LevelError)\n\tif errorCount > 0 {\n\t\treturn fmt.Errorf(\"logged %d error(s)\", errorCount)\n\t}\n\n\treturn nil\n}\n\n// Build lifecycle methods below.\n// The order listed matches the order of execution.\n\nfunc (h *HugoSites) initSites() error {\n\th.reset()\n\treturn nil\n}\n\nfunc (h *HugoSites) initRebuild(config *BuildCfg) error {\n\tif !h.Configs.Base.Internal.Watch {\n\t\treturn errors.New(\"rebuild called when not in watch mode\")\n\t}\n","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/hugo_sites_build.go#L229-L265","documentation":"This is the final aggregate guard at the end of HugoSites.Build (hugo_sites_build.go:247). After every lifecycle step has run, Hugo counts how many messages were logged at error level across the logger tree; if the count is non-zero it fails the whole build with this summary instead of returning nil. It exists because many subsystems log errors via SendError/Errorf rather than aborting, and a build that logged errors must not be reported as successful.","triggerScenarios":"Any subsystem logged an error during the build that did not propagate as a hard return value: printPathWarningsOnce failures, renderDeferred errors, postProcess errors sent via SendError, missing page references, broken internal links, or per-template render errors caught and logged. errorCount = LoggCount(Error) over both h.Log and the global logger.","commonSituations":"Broken `{{< ref >}}`/`{{< relref >}}` links logged as warnings-then-errors; references to non-existent pages/images; unused-template or path-warning flags escalated; a previous error was recovered from but still counted; mixing `h.Log.Error*` calls in a custom integration that never get cleared.","solutions":["Scroll up in the build log — each counted error was printed individually with its file/line; fix those first (this message is only the tally).","Search the log for 'ERROR' lines that precede this summary; the count matches them.","Run `hugo --logLevel debug` (or reduce log level) to surface the originating error if it was suppressed.","Re-run after fixing each source error; the tally only reaches 0 when none were logged."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := sites.Build(cfg); err != nil {\n    if strings.Contains(err.Error(), \"logged \") && strings.Contains(err.Error(), \"error(s)\") {\n        // this is a tally; the real errors were already printed — re-scan the log\n    }\n}","preventionTips":["Treat the build log above this line as the source of truth; fix each printed ERROR.","Run `hugo --logLevel info` to keep individual errors visible.","Gate CI on exit code, not on absence of this message, since other errors feed the count."],"tags":["build","aggregate","logging","fatal"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}