gohugoio/hugo · critical
no path info
Error message
no path info
What it means
A panic in HugoSites.loadData (hugolib/hugo_sites.go:712) when a data file's filesystem metadata has a nil PathInfo (fi.Meta().PathInfo == nil). PathInfo is attached during Hugo's filesystem mounting; nil means the file bypassed the proper path machinery.
Source
Thrown at hugolib/hugo_sites.go:712
return false, initPage(p)
},
)
}
func (h *HugoSites) loadData() error {
h.data = make(map[string]any)
w := hugofs.NewWalkway(
hugofs.WalkwayConfig{
Fs: h.PathSpec.BaseFs.Data.Fs,
IgnoreFile: h.SourceSpec.IgnoreFile,
PathParser: h.Conf.PathParser(),
WalkFn: func(ctx context.Context, path string, fi hugofs.FileMetaInfo) error {
if fi.IsDir() {
return nil
}
pi := fi.Meta().PathInfo
if pi == nil {
panic("no path info")
}
return h.handleDataFile(source.NewFileInfo(fi))
},
})
if err := w.Walk(); err != nil {
return err
}
return nil
}
func (h *HugoSites) handleDataFile(r *source.File) error {
var current map[string]any
f, err := r.FileInfo().Meta().Open()
if err != nil {
return fmt.Errorf("data: failed to open %q: %w", r.LogicalName(), err)
}View on GitHub (pinned to 52c9bd7908)
Solutions
- Check module [[mounts]] for the data directory are correct
- Remove custom filesystem hooks that bypass Hugo's mounting
- Report a bug with the mount configuration that reproduces it
Defensive patterns
Strategy: validation
Validate before calling
if fi.Meta().PathInfo == nil {
return fmt.Errorf("data file %q has no PathInfo; check module mounts", fi.Name())
} Prevention
- Ensure module [[mounts]] for /data use Hugo's mounting machinery
- Avoid injecting custom Afero filesystems that skip path metadata
- Report bugs with the mount config that reproduces a nil PathInfo
When it happens
Trigger: A file under /data is reached whose Afero metadata lacks PathInfo — e.g., a custom or broken module mount that did not attach path info, or a custom Afero filesystem injected into the data layer.
Common situations: Misconfigured module [[mounts]] for the data dir; a custom filesystem hook bypassing Hugo's mounting; a corrupted Hugo build.
Related errors
- archetype directory (%q) not supported
- data: failed to open %q: %w
- invalid cache config: %s
- invalid cache dir: %q
- publishDir is empty
AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09).
Data as JSON: /api/errors/ba62c8a1641cbea9.
Report an issue: GitHub.