{"record":{"id":"9a7f05da4a2f4480","repo":"apache/beam","slug":"error-readingf-w","errorCode":null,"errorMessage":"error readingf: %w","messagePattern":"error readingf: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go","lineNumber":290,"sourceCode":"\t// classpath jars should have relative path\n\trelClasspath := []string{}\n\tfor _, path := range classpathJars {\n\t\trelPath, err := filepath.Rel(cacheDir, path)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"error in creating relative path: %w\", err)\n\t\t}\n\t\trelClasspath = append(relClasspath, relPath)\n\t}\n\n\ttmpDir := filepath.Join(cacheDir, \"tmpDir\")\n\n\tif err := extractJar(mainJar, tmpDir); err != nil {\n\t\treturn \"\", fmt.Errorf(\"error in extractJar(): %w\", err)\n\t}\n\n\tmanifest, err := os.ReadFile(tmpDir + \"/META-INF/MANIFEST.MF\")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error readingf: %w\", err)\n\t}\n\n\t// trim the empty lines present at the end of MANIFEST.MF file.\n\tmanifestLines := strings.Split(string(manifest), \"\\n\")\n\tmanifestLines = manifestLines[:len(manifestLines)-2]\n\n\tclasspathString := fmt.Sprintf(\"%sClass-Path: %s\\n\", strings.Join(manifestLines, \"\\n\"), strings.Join(relClasspath, \" \"))\n\tif err = os.WriteFile(tmpDir+\"/META-INF/MANIFEST.MF\", []byte(classpathString), 0660); err != nil {\n\t\treturn \"\", fmt.Errorf(\"error writing ta manifest file: %w\", err)\n\t}\n\n\tpath, err := os.Getwd()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"can't get current working directory: %w\", err)\n\t}\n\n\tif err = os.Chdir(tmpDir); err != nil {\n\t\treturn \"\", fmt.Errorf(\"can't change to temp directory %s for creating JAR: %w\", tmpDir, err)","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go#L272-L308","documentation":"MakeJar reads tmpDir/META-INF/MANIFEST.MF after extracting the JAR and wraps any os.ReadFile failure as \"error readingf: %w\" (note the typo \"readingf\"). It means the extracted JAR did not contain a readable MANIFEST.MF at the expected location.","triggerScenarios":"extractJar succeeded but os.ReadFile(tmpDir+\"/META-INF/MANIFEST.MF\") returned an error: the manifest is missing from the JAR, the extraction produced a different directory layout, or tmpDir was removed between extract and read.","commonSituations":"A thin/generated JAR without a META-INF/MANIFEST.MF entry; extraction tooling or antivirus interfering with the temp dir; running MakeJar concurrently so another process cleaned tmpDir.","solutions":["Confirm the JAR actually contains META-INF/MANIFEST.MF (unzip -l mainJar).","Remove the stale cache/tmpDir and re-download the JAR, then retry.","Check tmpDir permissions and that no concurrent process deletes it.","If the JAR legitimately lacks a manifest, create it rather than using MakeJar, or package a JAR that includes one."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"zr, err := zip.OpenReader(mainJar)\nif err != nil {\n    return err\n}\ndefer zr.Close()\nhasManifest := false\nfor _, f := range zr.File {\n    if f.Name == \"META-INF/MANIFEST.MF\" {\n        hasManifest = true\n    }\n}\nif !hasManifest {\n    return errors.New(\"jar has no META-INF/MANIFEST.MF\")\n}","typeGuard":"func isNotExist(err error) bool {\n    return errors.Is(err, fs.ErrNotExist)\n}","tryCatchPattern":"jar, err := expansionx.MakeJar(ctx, target, repo, version)\nif err != nil && errors.Is(errors.Unwrap(errors.Unwrap(err)), fs.ErrNotExist) {\n    os.RemoveAll(cacheDir) // re-extract fresh\n    jar, err = expansionx.MakeJar(ctx, target, repo, version)\n}","preventionTips":["Verify JARs contain META-INF/MANIFEST.MF before MakeJar (jar tf / zip -l).","Don't share cacheDir/tmpDir between concurrent processes.","Re-download rather than reusing partially extracted directories."],"tags":["go","manifest","file-not-found","jar"],"backgroundTag":"file-not-found","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"}