{"record":{"id":"319837a32a44220e","repo":"apache/beam","slug":"error-getting-fileinfoheader-w","errorCode":null,"errorMessage":"error getting FileInfoHeader: %w","messagePattern":"error getting FileInfoHeader: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go","lineNumber":219,"sourceCode":"\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 {\n\t\t\treturn fmt.Errorf(\"error creating jarFile header: %w\", err)\n\t\t}\n\t\tif fileInfo.IsDir() {\n\t\t\treturn nil","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go#L201-L237","documentation":"zip.FileInfoHeader(fileInfo) returned an error while converting an os.FileInfo from the walk into a zip header. This is rare in practice — it only fails when the FileInfo's Sys() cannot be converted to the OS-specific type, so it usually indicates an unusual filesystem or a FileInfo not backed by a real OS file.","triggerScenarios":"During packJar's filepath.Walk, zip.FileInfoHeader receives a FileInfo whose underlying system data is nil or of unexpected type (not *syscall.Stat_t on Linux), e.g. from synthetic FileInfos or exotic FUSE/overlay filesystems.","commonSituations":"Packing a tree on an unusual mounted filesystem (some FUSE mounts, network filesystems) where Sys() is not the expected type; calling packJar with mocked FileInfos in tests.","solutions":["Retry on a standard local filesystem (move the source tree off the FUSE/network mount).","Verify you are passing real os.Stat-derived FileInfo values, not synthetic ones.","Update Go version if a platform-specific zip.FileInfoHeader bug is suspected; check the release notes.","As a workaround, construct zip.FileHeader manually (SetModTime/SetMode) from name+mode instead of FileInfoHeader."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"fileHeader, err := zip.FileInfoHeader(fileInfo)\nif err != nil {\n    // fall back to a manual header instead of failing the whole pack\n    fileHeader = &zip.FileHeader{Name: filepath.Base(path)}\n    fileHeader.SetMode(fileInfo.Mode())\n}","preventionTips":["Pack from local disk, not exotic FUSE/network filesystems.","Use real os.Stat FileInfos.","Keep Go toolchain up to date.","In tests, avoid synthetic FileInfos reaching packJar."],"tags":["go","zip","archive"],"backgroundTag":"internal-invariant-violation","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"}