gohugoio/hugo · error
process: %w
Error message
process: %w
What it means
Wraps a failure of the process() step — the phase that parses sources and creates Page objects (full or partial). The %w is the underlying processing error (template/page/error aggregation).
Source
Thrown at hugolib/hugo_sites_build.go:172
if len(events) > 0 || len(conf.WhatChanged.Changes()) > 0 {
// Rebuild
if err := h.initRebuild(conf); err != nil {
return fmt.Errorf("initRebuild: %w", err)
}
} else {
if err := h.initSites(); err != nil {
return fmt.Errorf("initSites: %w", err)
}
}
return nil
}
ctx := context.Background()
if err := h.process(ctx, infol, conf, init, events...); err != nil {
return fmt.Errorf("process: %w", err)
}
h.reportProgress(func() (state terminal.ProgressState, progress float64) {
return terminal.ProgressNormal, 0.15
})
if err := h.assemble(ctx, infol, conf); err != nil {
return fmt.Errorf("assemble: %w", err)
}
h.reportProgress(func() (state terminal.ProgressState, progress float64) {
return terminal.ProgressNormal, 0.20
})
return nil
}
if prepareErr = prepare(); prepareErr != nil {
h.SendError(prepareErr)
}
}View on GitHub (pinned to 52c9bd7908)
Solutions
- Unwrap %w — it usually carries file/line context for the offending content or template.
- Fix the named content file's front matter (YAML/TOML delimiters, unquoted colons).
- Fix shortcodes/partials referenced by the failing page.
- Run `hugo --verbose` to see which file process() choked on.
Example fix
<!-- before: broken shortcode call in a page -->
{{< myShortCode missing-arg >}}
<!-- after -->
{{< myShortCode arg="value" >}} Defensive patterns
Strategy: try-catch
Validate before calling
// Lint content front matter + shortcodes before building (e.g. via hugo --renderToMemory dry-run).
if err := validateContentFrontMatter(contentDir); err != nil { return err } Try / catch
if err := h.process(ctx, l, conf, init, events...); err != nil {
// process errors usually identify a single file; log and skip vs. abort per policy
h.Log.Errorf("process failed: %v", err)
return fmt.Errorf("process: %w", err)
} Prevention
- Validate front matter syntax in CI (yaml/toml linters).
- Test shortcodes/partials in isolation before content rollout.
- Run `hugo --verbose` to surface the offending file quickly.
When it happens
Trigger: Raised at hugo_sites_build.go:172 when h.process(ctx, infol, conf, init, events...) errors. This covers reading/parsing content files, handling file events for rebuilds, and the init callback errors.
Common situations: A content file with a front matter parse error; a shortcode/templating error during page creation; an init error (initRebuild/initSites) propagated; module import resolution failure while processing.
Related errors
- error building site: %w
- assemble: %w
- no existing content directory configured for this project
- shortcode has no name
- error processing file %q
AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09).
Data as JSON: /api/errors/315f603e634acfcd.
Report an issue: GitHub.