{"record":{"id":"e4de2237ea3cfeb3","repo":"GoogleContainerTools/skaffold","slug":"filepath-walk-w","errorCode":null,"errorMessage":"filepath walk: %w","messagePattern":"filepath walk: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/util/util.go","lineNumber":106,"sourceCode":"\t\t\t// This is a file reference, so just add it\n\t\t\tset.Add(path)\n\t\t\tcontinue\n\t\t}\n\n\t\tfiles, err := filepath.Glob(path)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"glob: %w\", err)\n\t\t}\n\t\tif len(files) == 0 {\n\t\t\tlog.Entry(context.TODO()).Warnf(\"%s did not match any file\", p)\n\t\t}\n\n\t\tfor _, f := range files {\n\t\t\tif err := walk.From(f).WhenIsFile().Do(func(path string, _ walk.Dirent) error {\n\t\t\t\tset.Add(path)\n\t\t\t\treturn nil\n\t\t\t}); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"filepath walk: %w\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn set.Files(), nil\n}\n\nfunc Ptr[T any](t T) *T {\n\to := t\n\treturn &o\n}\n\nfunc IsURL(s string) bool {\n\treturn strings.HasPrefix(s, \"http://\") || strings.HasPrefix(s, \"https://\")\n}\n\n// VerifyOrCreateFile checks if a file exists at the given path,\n// and if not, creates all parent directories and creates the file.","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/util/util.go#L88-L124","documentation":"After globbing, ExpandPathsGlob walks each matched path with walk.From(f).WhenIsFile().Do(...) to collect real files; this error wraps a failure from that walk. The walk fails when traversing a matched path hits an unreadable directory, a broken symlink being resolved, or the file disappears between globbing and walking. It aggregates the underlying walk error from dependency/test-path expansion.","triggerScenarios":"A glob match points to a directory the process cannot read (permission denied), a file matched by the glob is deleted between the Glob call and the walk, or a symlink target loop/missing target is encountered while expanding test or manifest dependencies.","commonSituations":"CI checkouts where files are pruned concurrently; NFS/overlay volumes with stale directory handles; restricted read permissions on dependency directories after a chown change; broken symlinks committed into the repo (e.g. symlink to a mounted toolchain path).","solutions":["Check and fix read/execute permissions on every directory matched by the glob pattern.","Remove or repair broken symlinks among the matched paths (find . -xtype l).","Re-run — if a concurrent process deletes files mid-walk, make the dependency set stable before running Skaffold.","Narrow the glob pattern so it only matches files that actually exist and are accessible."],"exampleFix":"// before\nstructureTests: [\"tests/**/*\"]   # matches broken symlink tests/latest -> /nonexistent\n// after\nln -sf /opt/tests/latest.json tests/latest.json   # repair the symlink\ntests/latest.json","handlingStrategy":"try-catch","validationCode":"// pre-check every glob match is a readable file\nfor _, f := range files {\n    info, err := os.Stat(f)\n    if err != nil || info.IsDir() {\n        return fmt.Errorf(\"dependency %q not a readable file\", f)\n    }\n    if fi, _ := os.Lstat(f); fi.Mode()&os.ModeSymlink != 0 {\n        if _, err := os.Stat(f); err != nil {\n            return fmt.Errorf(\"broken symlink %q\", f)\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"deps, err := util.ExpandPathsGlob(fs, paths)\nif err != nil {\n    if strings.Contains(err.Error(), \"filepath walk:\") {\n        log.Entry(ctx).Warnf(\"walk failed (%v); cleaning symlinks and retrying\", err)\n        exec.Command(\"find\", \".\", \"-xtype\", \"l\", \"-delete\").Run()\n        deps, err = util.ExpandPathsGlob(fs, paths)\n    }\n    if err != nil { return err }\n}","preventionTips":["Audit repos for broken symlinks (find . -xtype l) before builds.","Ensure all dependency directories have read+execute for the running user.","Keep the file tree stable while Skaffold resolves dependencies (no concurrent prune).","On network volumes, avoid stale handles by remounting before long CI runs."],"tags":["filepath","walk","filesystem","symlink","permissions"],"backgroundTag":"filepath-walk-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"}