apache/beam · warning
error getting FileInfoHeader
Error message
error getting FileInfoHeader: %w
What it means
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.
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.
Defensive patterns
Strategy: try-catch
Try / catch
fileHeader, err := zip.FileInfoHeader(fileInfo)
if err != nil {
// fall back to a manual header instead of failing the whole pack
fileHeader = &zip.FileHeader{Name: filepath.Base(path)}
fileHeader.SetMode(fileInfo.Mode())
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- error copying file
- error creating jarFile header
- error in extractJar()
- error in packJar()
- error opening jar for extractJar
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/319837a32a44220e.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go:219
defer jarFile.Close()
fileInfo, err := os.Stat(source)
if err != nil {
return fmt.Errorf("source path %s doesn't exist: %w", source, err)
}
var sourceDir string
if fileInfo.IsDir() {
sourceDir = filepath.Base(source)
}
err = filepath.Walk(source, func(path string, fileInfo os.FileInfo, err error) error {
if err != nil {
return fmt.Errorf("error accesing path %s: %w", path, err)
}
fileHeader, err := zip.FileInfoHeader(fileInfo)
if err != nil {
return fmt.Errorf("error getting FileInfoHeader: %w", err)
}
if sourceDir != "" {
fileHeader.Name = filepath.Join(sourceDir, strings.TrimPrefix(path, source))
}
if fileInfo.IsDir() {
fileHeader.Name += "/"
} else {
fileHeader.Method = zip.Deflate
}
writer, err := jarFile.CreateHeader(fileHeader)
if err != nil {
return fmt.Errorf("error creating jarFile header: %w", err)
}
if fileInfo.IsDir() {
return nilView on GitHub (pinned to 12126d8942)