{"record":{"id":"603b2a27d29ad195","repo":"GoogleContainerTools/skaffold","slug":"stating-file-q-w","errorCode":null,"errorMessage":"stating file %q: %w","messagePattern":"stating file %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/docker/syncmap.go","lineNumber":74,"sourceCode":"}\n\n// walkWorkspaceWithDestinations walks the given host directories and determines their\n// location in the container. It returns a map of host path by container destination.\n// Note: if you change this function, you might also want to modify `WalkWorkspace`.\nfunc walkWorkspaceWithDestinations(workspace string, excludes []string, fts []FromTo) (map[string]string, error) {\n\tdockerIgnored, err := NewDockerIgnorePredicate(workspace, excludes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Walk the workspace\n\tsrcByDest := make(map[string]string)\n\tfor _, ft := range fts {\n\t\tabsFrom := filepath.Join(workspace, ft.From)\n\n\t\tfi, err := os.Stat(absFrom)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"stating file %q: %w\", absFrom, err)\n\t\t}\n\n\t\tswitch mode := fi.Mode(); {\n\t\tcase mode.IsDir():\n\t\t\tkeepFile := func(path string, info walk.Dirent) (bool, error) {\n\t\t\t\tif info.IsDir() {\n\t\t\t\t\tif path == absFrom || util.IsEmptyDir(path) {\n\t\t\t\t\t\treturn true, nil\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tignored, err := dockerIgnored(path, info)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn false, err\n\t\t\t\t}\n\n\t\t\t\treturn !ignored, nil\n\t\t\t}","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/docker/syncmap.go#L56-L92","documentation":"Skaffold's SyncMap builds a map of source files to their destinations inside the container for file sync. Before walking, it stats each artifact's 'from' path in the workspace; if os.Stat fails (path missing or inaccessible), the stat error is wrapped with the absolute path and returned, aborting sync-map computation.","triggerScenarios":"Calling SyncMap for an artifact whose build context lists a sync rule with a 'from' path (ft.From) that does not exist or is unreadable under the workspace directory; os.Stat returns e.g. ENOENT, EACCES, or the path is a broken symlink.","commonSituations":"Typo in skaffold.yaml sync 'from' path; sync source deleted/renamed after config was written; running skaffold dev from the wrong working directory so the workspace path resolves incorrectly; permission-restricted checkout (CI running as non-root over root-owned files).","solutions":["Verify the sync 'from' path in skaffold.yaml exists relative to the artifact's build context (run ls <workspace>/<from>)","Run skaffold from the directory containing the workspace, or fix the context field so workspace resolves correctly","Check file/directory permissions (chmod/chown) if the path exists but stat fails with EACCES","Remove stale sync entries pointing at deleted files"],"exampleFix":"// before (skaffold.yaml)\nsync:\n  manual:\n    - src: 'src/**/*.ts'\n      dest: ./app/src\n// after — src path must exist under the build context:\n// mkdir -p src && ensure *.ts files exist, or correct src: to the real directory","handlingStrategy":"validation","validationCode":"for _, ft := range fts {\n    absFrom := filepath.Join(workspace, ft.From)\n    if _, err := os.Stat(absFrom); err != nil {\n        return fmt.Errorf(\"sync source %q missing before SyncMap: %w\", absFrom, err)\n    }\n}","typeGuard":"func syncSourceExists(workspace, from string) bool {\n    _, err := os.Stat(filepath.Join(workspace, from))\n    return err == nil\n}","tryCatchPattern":"if err := SyncMap(fts, workspace); err != nil {\n    var pErr *fs.PathError\n    if errors.As(err, &pErr) && errors.Is(pErr.Err, fs.ErrNotExist) {\n        log.Warnf(\"skipping sync: source %q missing\", pErr.Path)\n        return nil\n    }\n    return err\n}","preventionTips":["Validate every sync 'from' path against the build context at config-load time","Keep sync rules generated or linted against the actual source tree","Run skaffold from the repo root so relative workspaces resolve consistently","Add a CI check that all skaffold.yaml sync sources exist"],"tags":["filesystem","file-sync","stat"],"backgroundTag":"file-not-found","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"}