gohugoio/hugo · error
logged error(s)
Error message
logged %d error(s)
What it means
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.
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.
Defensive patterns
Strategy: try-catch
Try / catch
if err := sites.Build(cfg); err != nil {
if strings.Contains(err.Error(), "logged ") && strings.Contains(err.Error(), "error(s)") {
// this is a tally; the real errors were already printed — re-scan the log
}
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- assemble
- deferred execution with id
- error building site
- error copying static files
- failed to acquire a build lock
AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09).
Data as JSON: /api/errors/265885dc4a5b70b6.
Report an issue: GitHub.
Appendix: source
Thrown at hugolib/hugo_sites_build.go:247
h.Log.Printf("\nTemplate Metrics:\n\n")
h.Log.Println(b.String())
}
h.StopErrorCollector()
err := <-errs
if err != nil {
return err
}
if err := h.fatalErrorHandler.getErr(); err != nil {
return err
}
errorCount := h.Log.LoggCount(logg.LevelError) + loggers.Log().LoggCount(logg.LevelError)
if errorCount > 0 {
return fmt.Errorf("logged %d error(s)", errorCount)
}
return nil
}
// Build lifecycle methods below.
// The order listed matches the order of execution.
func (h *HugoSites) initSites() error {
h.reset()
return nil
}
func (h *HugoSites) initRebuild(config *BuildCfg) error {
if !h.Configs.Base.Internal.Watch {
return errors.New("rebuild called when not in watch mode")
}
View on GitHub (pinned to 52c9bd7908)