gohugoio/hugo · error
readAndProcessContent: %w
Error message
readAndProcessContent: %w
What it means
Outer wrapper from HugoSites.processFull (hugo_sites_build.go:1278) around whatever processFiles returns. processFiles is the stage that reads and processes all content/source files (markdown, page bundles, resources) into the page trees. The %w is the concrete read/parse error; this label just names the stage so the cause is traceable.
Source
Thrown at hugolib/hugo_sites_build.go:1278
}
return nil
}
func (h *HugoSites) LogServerAddresses() {
if h.hugoInfo.IsMultihost() {
for _, s := range h.Sites {
h.Log.Printf("Web Server is available at %s (bind address %s) %s\n", s.conf.C.BaseURL, s.conf.C.ServerInterface, s.Language().Lang)
}
} else {
s := h.Sites[0]
h.Log.Printf("Web Server is available at %s (bind address %s)\n", s.conf.C.BaseURL, s.conf.C.ServerInterface)
}
}
func (h *HugoSites) processFull(ctx context.Context, l logg.LevelLogger, config *BuildCfg) (err error) {
if err = h.processFiles(ctx, l, config); err != nil {
err = fmt.Errorf("readAndProcessContent: %w", err)
return
}
return err
}
func (s *Site) handleContentAdapterChanges(bi pagesfromdata.BuildInfo, buildConfig *BuildCfg) {
if !s.h.isRebuild() {
return
}
if len(bi.ChangedIdentities) > 0 {
buildConfig.WhatChanged.Add(bi.ChangedIdentities...)
buildConfig.WhatChanged.needsPagesAssembly = true
}
for _, p := range bi.DeletedPaths {
pp := paths.AddLeadingSlash(path.Join(bi.Path.Base(), p.Path))
df := func(n contentNode) bool {View on GitHub (pinned to 52c9bd7908)
Solutions
- Inspect the wrapped %w — it carries the file path and the parse/read cause.
- Open the named content file and fix the syntax (front matter delimiters, shortcode balance).
- If on watch, verify the file still exists at the reported path (race with an editor save).
- For content adapters, check the data source/script output that feeds them.
Defensive patterns
Strategy: try-catch
Validate before calling
// validate content files parse before full build (library use) // hugo already reports file/line in the wrapped error; pre-check front matter with a YAML/TOML linter
Try / catch
if err := sites.Build(cfg); err != nil {
if strings.HasPrefix(err.Error(), "readAndProcessContent:") {
cause := errors.Unwrap(err) // the file/parse-level detail
_ = cause
}
} Prevention
- Lint front matter and shortcode balance in content files.
- On watch, ignore transient errors mid-save and re-trigger the rebuild.
When it happens
Trigger: Any failure inside the file ingestion/content-processing pipeline: a content file that fails to parse, a file-system read error, a page-bundle resource that cannot be loaded, a fatal error from a content adapter (data-driven pages), or an error from processContentAdaptersOnRebuild during watch rebuilds.
Common situations: Malformed front matter or broken shortcodes in a content file; a content file deleted/moved between two watch ticks; a remote/adapter content source returning an error; permission issues reading files under content/.
Related errors
- no sites to build
- 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@52c9bd7908 (2026-08-09).
Data as JSON: /api/errors/76b6bde845066daa.
Report an issue: GitHub.