{"id":"32dbb48e15ef4880","repo":"gohugoio/hugo","slug":"walk-stat-s","errorCode":null,"errorMessage":"walk: stat: %s","messagePattern":"walk: stat: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugofs/walk.go","lineNumber":139,"sourceCode":"\n\treturn false\n}\n\n// walk recursively descends path, calling walkFn.\nfunc (w *Walkway) walk(ctx context.Context, path string, info FileMetaInfo, dirEntries []FileMetaInfo) error {\n\tpathRel := strings.TrimPrefix(path, w.cfg.Root)\n\n\tif info == nil {\n\t\tvar err error\n\t\tfi, err := w.cfg.Fs.Stat(path)\n\t\tif err != nil {\n\t\t\tif path == w.cfg.Root && herrors.IsNotExist(err) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif w.checkErr(path, err) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"walk: stat: %s\", err)\n\t\t}\n\t\tinfo = fi.(FileMetaInfo)\n\t}\n\n\terr := w.cfg.WalkFn(ctx, path, info)\n\tif err != nil {\n\t\tif info.IsDir() && err == filepath.SkipDir {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\tif !info.IsDir() {\n\t\treturn nil\n\t}\n\n\tif dirEntries == nil {\n\t\tf, err := w.cfg.Fs.Open(path)","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/hugofs/walk.go#L121-L157","documentation":"Walkway.walk traverses Hugo's virtual filesystem (content, static, assets, module mounts). When it needs a FileInfo for the current path and Fs.Stat fails with anything other than a tolerated not-exist error, it wraps the failure as \"walk: stat: ...\". Not-exist on the walk root, or not-exist while FailOnNotExist is off, is silently skipped/warned; other stat errors abort the walk and typically fail the build.","triggerScenarios":"Fs.Stat(path) returning a non-IsNotExist error during directory walking — permission denied on a content/static/asset directory, I/O errors, broken symlinks pointing into unreadable locations, or a file removed/replaced mid-walk when FailOnNotExist is set.","commonSituations":"Building as a user without read permission on part of the project (Docker/CI volume permissions), network or overlay filesystems returning transient errors, symlinked content directories with dangling or unreadable targets, and files being deleted by another process (editor, sync tool) during `hugo server` rebuilds.","solutions":["Read the wrapped error: for permission denied, fix ownership/permissions of the reported path (common in Docker/CI mounts).","For dangling symlinks under content/static/assets, remove or fix the link target.","If files are being removed during watch rebuilds by a sync tool, exclude its temp files or re-run the build."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if _, err := os.Stat(root); err != nil {\n\t// root missing or unreadable — fix path/permissions before walking\n\treturn err\n}","typeGuard":null,"tryCatchPattern":"err := w.Walk()\nif err != nil {\n\t// stat failed on the walk root; use errors.Is(err, fs.ErrNotExist) / fs.ErrPermission to distinguish\n}","preventionTips":["Verify the directory exists (content/, static/, mounted module dirs) before configuring it as a mount.","Check for broken symlinks — stat follows them and fails on dangling targets.","Use absolute, correctly-cased paths; case mismatches surface as stat errors on case-sensitive filesystems."],"tags":["hugo","filesystem","walk","permissions","io"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}