{"record":{"id":"0104e704e3b376b5","repo":"apache/beam","slug":"error-accesing-path-s-w","errorCode":null,"errorMessage":"error accesing path %s: %w","messagePattern":"error accesing path (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go","lineNumber":215,"sourceCode":"\t}\n\tdefer jar.Close()\n\n\tjarFile := zip.NewWriter(jar)\n\tdefer jarFile.Close()\n\n\tfileInfo, err := os.Stat(source)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"source path %s doesn't exist: %w\", source, err)\n\t}\n\n\tvar sourceDir string\n\tif fileInfo.IsDir() {\n\t\tsourceDir = filepath.Base(source)\n\t}\n\n\terr = filepath.Walk(source, func(path string, fileInfo os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error accesing path %s: %w\", path, err)\n\t\t}\n\t\tfileHeader, err := zip.FileInfoHeader(fileInfo)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error getting FileInfoHeader: %w\", err)\n\t\t}\n\n\t\tif sourceDir != \"\" {\n\t\t\tfileHeader.Name = filepath.Join(sourceDir, strings.TrimPrefix(path, source))\n\t\t}\n\n\t\tif fileInfo.IsDir() {\n\t\t\tfileHeader.Name += \"/\"\n\t\t} else {\n\t\t\tfileHeader.Method = zip.Deflate\n\t\t}\n\n\t\twriter, err := jarFile.CreateHeader(fileHeader)\n\t\tif err != nil {","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go#L197-L233","documentation":"While walking the source tree inside packJar, filepath.Walk invoked the callback with a non-nil err for a path — the directory entry itself could not be read (open/readdir/lstat failure). The code wraps it with the offending path so you know which node of the tree was inaccessible.","triggerScenarios":"filepath.Walk(source, ...) hits a path it cannot access: unreadable subdirectory, dangling symlink whose lstat fails, file deleted between listing and visiting, or permission errors on nested dirs (EACCES, ENOENT).","commonSituations":"JAR contents extracted with restrictive modes (dirs created 0700 by extractJar) and packing runs as a different user; a symlink in tmpDir pointing outside to a deleted target; file removed by a concurrent cleanup while walking.","solutions":["Fix permissions on the source tree so the packing process can read all files/dirs (chmod -R u+rX tmpDir).","Remove dangling symlinks or unreadable entries from the extraction directory.","Recreate the tree cleanly: delete tmpDir, re-run extractJar, then pack.","Check no concurrent process is mutating the source directory during packing."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"err := filepath.Walk(source, func(p string, fi os.FileInfo, err error) error {\n    if err != nil { return err } // surface early\n    return nil\n})","typeGuard":null,"tryCatchPattern":"err = filepath.Walk(source, func(path string, fi os.FileInfo, err error) error {\n    if err != nil {\n        var pe *fs.PathError\n        if errors.As(err, &pe) && (errors.Is(pe.Err, fs.ErrPermission) || errors.Is(pe.Err, fs.ErrNotExist)) {\n            return fmt.Errorf(\"error accesing path %s: %w\", path, err) // log & skip vs fail per policy\n        }\n        return err\n    }\n    return packEntry(path, fi)\n})","preventionTips":["chmod -R u+rX the extraction tree before packing.","Strip dangling symlinks after extraction.","Pack as the same user that extracted the files.","Don't mutate the tree during Walk."],"tags":["go","filesystem","walk","permissions"],"backgroundTag":"file-read-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}