gohugoio/hugo · error
logged %d error(s)
Error message
logged %d error(s)
What it means
At the end of a build, Hugo checks the logger's error counter; if any ERROR-level messages were emitted during the build (by templates calling errorf, render hooks, deprecations promoted to errors, etc.), the build is failed with this summary error even though no single step returned a hard error. It converts logged errors into a non-zero exit.
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 8a468df065)
Solutions
- Scroll up in the build output — the real ERROR lines precede this summary; fix each of them.
- For deprecation errors, update the deprecated config/template usage named in the log.
- If an error is expected and tolerable, use `ignoreLogs` with the error's id (shown in the log) in site config.
- For ref errors, fix broken links or lower `refLinksErrorLevel` to 'WARNING' as a stopgap.
Defensive patterns
Strategy: try-catch
Type guard
func isLoggedErrors(err error) bool {
return err != nil && strings.Contains(err.Error(), "logged") && strings.Contains(err.Error(), "error(s)")
} Try / catch
if err := h.Build(cfg); err != nil {
if isLoggedErrors(err) {
// aggregate marker: real causes were already written to the logger
// read the captured log output for the per-page errors
}
return err
} Prevention
- Attach a capturing logger to the build so the individual errors behind the count are retrievable
- Treat this as an aggregate signal — fix the first logged error and rebuild; later ones are often cascades
- Don't set ignoreErrors/ignoreLogs broadly; suppressed warnings escalate into this opaque failure
When it happens
Trigger: Build completes but h.Log.LoggCount(logg.LevelError) > 0: templates invoking `errorf`, ERROR-level deprecation warnings (features past their deprecation window), warnings escalated via `--logLevel` config, or REF_NOT_FOUND-style errors when `refLinksErrorLevel = 'ERROR'`.
Common situations: Upgrading Hugo so an old WARN deprecation graduated to ERROR; broken `ref`/`relref` links with strict ref error level; a theme's errorf guard firing (e.g. missing required params); CI failing with this message while the actual errors are earlier in the log.
Related errors
- invalid log level: %q, must be one of debug, warn, info or e
- error copying static files: %w
- error building site: %w
- failed to compile cache buster %q: %w
- failed to compile cache buster source %q: %w
AI-assisted analysis of gohugoio/hugo@8a468df065 (2026-07-31).
Data as JSON: /data/errors/265885dc4a5b70b6.json.
Report an issue: GitHub ↗.