{"record":{"id":"f417297cb828b2ac","repo":"gohugoio/hugo","slug":"walk-readdir-w","errorCode":null,"errorMessage":"walk: Readdir: %w","messagePattern":"walk: Readdir: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugofs/walk.go","lineNumber":172,"sourceCode":"\t}\n\n\tif dirEntries == nil {\n\t\tf, err := w.cfg.Fs.Open(path)\n\t\tif err != nil {\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: open: path: %q filename: %q: %s\", path, info.Meta().Filename, err)\n\t\t}\n\t\tfis, newCtx, err := ReadDirWithContext(ctx, f, -1)\n\t\tctx = newCtx\n\n\t\tf.Close()\n\t\tif err != nil {\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: Readdir: %w\", err)\n\t\t}\n\n\t\tdirEntries = DirEntriesToFileMetaInfos(fis)\n\t\tfor _, fi := range dirEntries {\n\t\t\tif fi.Meta().PathInfo == nil {\n\t\t\t\tfi.Meta().PathInfo = w.cfg.PathParser.Parse(\"\", filepath.Join(pathRel, fi.Name()))\n\t\t\t}\n\t\t}\n\n\t\tif w.cfg.SortDirEntries {\n\t\t\tsort.Slice(dirEntries, func(i, j int) bool {\n\t\t\t\treturn dirEntries[i].Name() < dirEntries[j].Name()\n\t\t\t})\n\t\t}\n\n\t}\n\n\tif w.cfg.IgnoreFile != nil {","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugofs/walk.go#L154-L190","documentation":"Emitted by Walkway.walk when ReadDirWithContext fails while enumerating a directory's entries after it was successfully opened. Distinct from the open error (302): the directory opened fine but reading its contents errored. Wrapped as 'walk: Readdir: %w'.","triggerScenarios":"An I/O error partway through reading a large directory (EIO), an afero backing store that fails listing (e.g. a remote/overlay fs whose list RPC errors), or an underlying ReadDir returning a non-nil, non-EOF error. The file is Closed immediately after, so the error propagates from ReadDirWithContext.","commonSituations":"Network/overlay filesystem flakiness on a content or assets mount; a directory with an enormous entry count hitting an fs-specific limit; a corrupt directory entry; concurrent removal of the directory's inode after Open but before full read.","solutions":["Unwrap the %w to get the concrete ReadDir error and act on its syscall code (EIO vs ENOENT vs EACCES).","Reduce the directory's entry count or restructure into subdirectories if an fs limit is hit.","For overlay/remote mounts, retry the build or mount the directory from a stable local source.","Confirm the directory still exists and is readable on the underlying filesystem after the build fails."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := walkway.Walk()\nif err != nil && strings.Contains(err.Error(), \"walk: Readdir:\") {\n    var perr *fs.PathError\n    if errors.As(errors.Unwrap(err), &perr) && isTransient(perr.Err) { /* retry once */ }\n}","preventionTips":["Keep walked directories on stable local storage; avoid flaky remote mounts.","Split oversized directories to stay under fs-specific listing limits.","Retry the build once for transient I/O; investigate if it persists."],"tags":["filesystem","hugofs","walk","readdir","io"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}