{"record":{"id":"a6bcd04995892686","repo":"apache/beam","slug":"error-creating-jarfile-header-w","errorCode":null,"errorMessage":"error creating jarFile header: %w","messagePattern":"error creating jarFile header: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go","lineNumber":234,"sourceCode":"\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\n\t\t}\n\n\t\tf, err := os.Open(path)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error opening file %s: %w\", path, err)\n\t\t}\n\t\tdefer f.Close()\n\n\t\tif _, err = io.Copy(writer, f); err != nil {\n\t\t\treturn fmt.Errorf(\"error copying file %s: %w\", path, err)\n\t\t}\n\t\treturn nil\n\t})\n\treturn err\n}","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go#L216-L252","documentation":"jarFile.CreateHeader(fileHeader) failed while adding an entry to the output zip writer in packJar. The zip.Writer could not accept the header — typically because the underlying file write failed (disk full, I/O error) or the header is invalid (e.g. oversized/invalid name).","triggerScenarios":"During the filepath.Walk callback, CreateHeader fails writing to the zip stream: ENOSPC on the destination volume, underlying jar file write I/O error, or an invalid header produced from odd file metadata.","commonSituations":"Full disk when repacking a large Uber JAR; destination volume with I/O errors; extremely long file names inside the extracted tree producing invalid zip entry names.","solutions":["Free space on the volume holding the output jar (df -h) and retry.","Check filesystem health (dmesg / smartctl) if I/O errors appear in the wrapped message.","Shorten or sanitize unusually long entry names in the source tree.","Delete the partial output jar and re-run packJar from a clean state."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if len(fileHeader.Name) > 1024 { return fmt.Errorf(\"entry name too long: %s\", fileHeader.Name) }\nif err := checkDiskSpace(destDir, requiredBytes); err != nil { return err }","typeGuard":null,"tryCatchPattern":"writer, err := jarFile.CreateHeader(fileHeader)\nif err != nil {\n    if errors.Is(err, syscall.ENOSPC) { /* free space then retry */ }\n    return fmt.Errorf(\"error creating jarFile header: %w\", err)\n}","preventionTips":["Ensure ample free space for the repacked JAR (roughly 2x original).","Sanitize/limit entry name lengths in source trees.","Retry MakeJar from a clean state after any ENOSPC.","Monitor filesystem errors (dmesg)."],"tags":["go","zip","jar","io"],"backgroundTag":"file-write-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"}