{"record":{"id":"cc4e3f8eda738666","repo":"apache/beam","slug":"error-in-getlocal-w","errorCode":null,"errorMessage":"error in getLocal(): %w","messagePattern":"error in getLocal\\(\\): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go","lineNumber":268,"sourceCode":"\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 {\n\t\t\tclasspathJars = append(classpathJars, j)\n\t\t} else {\n\t\t\treturn \"\", fmt.Errorf(\"error in getLocal(): %w\", err)\n\t\t}\n\t}\n\n\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}","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go#L250-L286","documentation":"MakeJar could not resolve a classpath JAR locally: getLocalJar(path) (referred to as getLocal in the message) returned an error for one of the space-separated classpath entries. getLocalJar either downloads the JAR (network/HTTP failure) or locates it in the local cache (stat/open failure); the original error is wrapped here with the 'error in getLocal():' prefix.","triggerScenarios":"startAutomatedJavaExpansionService calls MakeJar(mainJar, classpath); for each entry expandJar(jar) computes a path and getLocalJar either fails to find the file locally (not cached, bad coordinate) or its download path fails (non-200 HTTP response, network error, cannot create the cached jar file).","commonSituations":"Maven coordinate in the --java_expansion_jarclasspath option is misspelled or doesn't exist in the repo; offline/air-gapped environment so download fails; cache dir unwritable; malformed classpath string with wrong separators.","solutions":["Verify each classpath entry resolves to a real artifact; fix typos in the Maven coordinate (group:artifact:version).","Check network/proxy connectivity to the artifact repository, or pre-populate the local jar cache (~/.beam661bea09-...) with the JAR.","Inspect the wrapped inner error: if it mentions HTTP status, fix the repository URL; if it mentions permissions, fix the cache dir ownership.","Ensure the classpath string uses space-separated entries as expected by MakeJar (strings.Split(classpath, \" \"))."],"exampleFix":"// before: bad coordinate\n--java_expansion_jarclasspath=com.example:missing-art:1.0\n// after: verified coordinate present in the repository\n--java_expansion_jarclasspath=com.example:existing-art:1.0","handlingStrategy":"fallback","validationCode":"for _, jar := range strings.Split(classpath, \" \") {\n    p := expandJar(jar)\n    if _, err := os.Stat(p); err != nil {\n        return fmt.Errorf(\"classpath entry %q not cached locally at %s\", jar, p)\n    }\n}","typeGuard":null,"tryCatchPattern":"if j, err := getLocalJar(path); err == nil {\n    classpathJars = append(classpathJars, j)\n} else {\n    if errors.Is(err, os.ErrNotExist) { /* pre-cache or download */ }\n    return \"\", fmt.Errorf(\"error in getLocal(): %w\", err)\n}","preventionTips":["Double-check Maven coordinates in --java_expansion_jarclasspath.","Pre-populate the local jar cache for air-gapped environments.","Ensure the HTTP proxy/mirror env vars are set for artifact downloads.","Keep classpath entries space-separated as MakeJar expects."],"tags":["go","jar","classpath","network"],"backgroundTag":"resource-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"}