{"record":{"id":"2ffe2cd6a6c2999e","repo":"apache/beam","slug":"error-copying-file-s-w","errorCode":null,"errorMessage":"error copying file %s: %w","messagePattern":"error copying file (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go","lineNumber":247,"sourceCode":"\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}\n\n// MakeJar fetches additional classpath JARs and adds it to the classpath of\n// main JAR file and compiles a fresh JAR.\nfunc MakeJar(mainJar string, classpath string) (string, error) {\n\tusr, _ := user.Current()\n\tcacheDir := filepath.Join(usr.HomeDir, jarCache[2:])\n\n\t// fetch jars required in classpath\n\tclasspaths := strings.Split(classpath, \" \")\n\tclasspathJars := []string{}\n\tfor _, jar := range classpaths {\n\t\tpath := expandJar(jar)\n\t\tif j, err := getLocalJar(path); err == nil {","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go#L229-L265","documentation":"io.Copy(writer, f) failed while streaming a source file's contents into the zip entry, meaning either reading the source file or (more often) writing to the zip stream failed mid-copy. The error carries the source path; the underlying cause is wrapped from io.Copy.","triggerScenarios":"During packJar's walk callback, io.Copy between the opened source file and the zip entry writer errors: source read error (EIO, truncated file) or destination write error (ENOSPC on the volume holding the output jar).","commonSituations":"Full or failing disk while repacking a large JAR; corrupted/truncated file in the extracted tree; network storage dropping mid-read; quota exceeded on the destination volume.","solutions":["Free disk space on the output volume and re-run MakeJar/packJar.","Verify the failing file is readable and not corrupt (cmp it against the original JAR entry; re-extract if needed).","Check volume quota and filesystem health if the wrapped error is a write error.","Retry from a clean state: remove the partial output jar and tmpDir, then re-extract and pack."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if fi, err := os.Stat(path); err != nil || fi.Size() == 0 && expectedSize > 0 { return fmt.Errorf(\"source file bad: %s\", path) }","typeGuard":null,"tryCatchPattern":"if _, err = io.Copy(writer, f); err != nil {\n    return fmt.Errorf(\"error copying file %s: %w\", path, err)\n}\n// caller: on ENOSPC/EIO, clean partial jar + tmpDir and retry MakeJar once","preventionTips":["Keep enough free disk for the fully repacked JAR.","Verify extracted files against the source JAR checksums.","Use local (not network) storage for tmpDir and output.","Retry the whole MakeJar flow from a clean cache after I/O errors."],"tags":["go","io","zip","jar"],"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"}