{"record":{"id":"5aa4564b27e54e0c","repo":"GoogleContainerTools/skaffold","slug":"unable-to-list-files","errorCode":null,"errorMessage":"unable to list files: ","messagePattern":"unable to list files: ","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/walk/walk.go","lineNumber":155,"sourceCode":"\t\treturn action(w.dir, info)\n\t}\n\n\treturn godirwalk.Walk(w.dir, &godirwalk.Options{\n\t\tUnsorted: w.unsorted,\n\t\tCallback: func(path string, info *godirwalk.Dirent) error {\n\t\t\tmatch, err := w.predicate(path, info)\n\t\t\tif !match || err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn action(path, info)\n\t\t},\n\t})\n}\n\nfunc (w *builder) MustDo(action Action) {\n\tif err := w.Do(action); err != nil {\n\t\tpanic(\"unable to list files: \" + err.Error())\n\t}\n}\n\n// Predicates\n\nfunc hasName(name string) Predicate {\n\treturn func(_ string, info Dirent) (bool, error) {\n\t\treturn info.Name() == name, nil\n\t}\n}\n\nfunc nameMatches(glob string) Predicate {\n\treturn func(_ string, info Dirent) (bool, error) {\n\t\treturn path.Match(glob, info.Name())\n\t}\n}\n\nfunc isDir(_ string, info Dirent) (bool, error) {","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/walk/walk.go#L137-L173","documentation":"walk.builder.MustDo runs the file-tree walk action and panics with \"unable to list files: <err>\" if Do returns an error. It is a convenience for call sites where a failed dependency/file listing makes further progress impossible, converting fs errors (permission denied, missing directory, symlink loops) into a panic.","triggerScenarios":"Calling MustDo (e.g. while building the dependency list for watching/diagnose) when walking the workspace fails: unreadable directory (permissions), deleted directory mid-walk, too many open files, or symlink cycles.","commonSituations":"Build artifacts or node_modules owned by root/unreadable by the skaffold process; workspace path deleted while skaffold runs; ENFILE/EMFILE file-descriptor limits on large monorepos; broken symlinks in the source tree.","solutions":["Fix filesystem permissions on the unreadable directory shown in the wrapped error","Raise the open-file limit (ulimit -n) for large trees hitting EMFILE","Remove or fix broken/cyclic symlinks in the workspace","Use the non-panicking Do API and handle the error at the call site if a partial walk is acceptable"],"exampleFix":"// before\nwalker.MustDo(func(path string, _ fs.FileInfo) error { ... })\n// after\nerr := walker.Do(func(path string, _ fs.FileInfo) error { ... })\nif err != nil {\n  return fmt.Errorf(\"listing files: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":"if _, err := os.Stat(workspaceRoot); err != nil {\n  return fmt.Errorf(\"workspace inaccessible: %w\", err)\n}\nif fi, err := os.Stat(workspaceRoot); err == nil && !fi.IsDir() {\n  return fmt.Errorf(\"workspace is not a directory\")\n}","typeGuard":"func dirReadable(path string) bool {\n  f, err := os.Open(path)\n  if err != nil { return false }\n  f.Close()\n  return true\n}","tryCatchPattern":"func walkSafe(b *walk.Builder, a walk.Action) (err error) {\n  defer func() { if r := recover(); r != nil { err = fmt.Errorf(\"walk failed: %v\", r) } }()\n  b.MustDo(a)\n  return nil\n}","preventionTips":["Run skaffold with read access to the entire workspace (avoid root-owned build dirs)","Raise ulimit -n on large repos","Prune broken symlinks and exclude node_modules/build output from walks","Prefer Do() over MustDo() in code that can tolerate a failed listing"],"tags":["filesystem","walk","panic","permissions"],"backgroundTag":"file-listing-failed","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}