apache/beam · error

error in getLocal()

Error message

error in getLocal(): %w

What it means

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.

Solutions

  1. Verify each classpath entry resolves to a real artifact; fix typos in the Maven coordinate (group:artifact:version).
  2. Check network/proxy connectivity to the artifact repository, or pre-populate the local jar cache (~/.beam661bea09-...) with the JAR.
  3. Inspect the wrapped inner error: if it mentions HTTP status, fix the repository URL; if it mentions permissions, fix the cache dir ownership.
  4. Ensure the classpath string uses space-separated entries as expected by MakeJar (strings.Split(classpath, " ")).

Example fix

// before: bad coordinate
--java_expansion_jarclasspath=com.example:missing-art:1.0
// after: verified coordinate present in the repository
--java_expansion_jarclasspath=com.example:existing-art:1.0
Defensive patterns

Strategy: fallback

Validate before calling

for _, jar := range strings.Split(classpath, " ") {
    p := expandJar(jar)
    if _, err := os.Stat(p); err != nil {
        return fmt.Errorf("classpath entry %q not cached locally at %s", jar, p)
    }
}

Try / catch

if j, err := getLocalJar(path); err == nil {
    classpathJars = append(classpathJars, j)
} else {
    if errors.Is(err, os.ErrNotExist) { /* pre-cache or download */ }
    return "", fmt.Errorf("error in getLocal(): %w", err)
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/cc4e3f8eda738666. Report an issue: GitHub.

Appendix: source

Thrown at sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go:268

	})
	return err
}

// MakeJar fetches additional classpath JARs and adds it to the classpath of
// main JAR file and compiles a fresh JAR.
func MakeJar(mainJar string, classpath string) (string, error) {
	usr, _ := user.Current()
	cacheDir := filepath.Join(usr.HomeDir, jarCache[2:])

	// fetch jars required in classpath
	classpaths := strings.Split(classpath, " ")
	classpathJars := []string{}
	for _, jar := range classpaths {
		path := expandJar(jar)
		if j, err := getLocalJar(path); err == nil {
			classpathJars = append(classpathJars, j)
		} else {
			return "", fmt.Errorf("error in getLocal(): %w", err)
		}
	}

	// classpath jars should have relative path
	relClasspath := []string{}
	for _, path := range classpathJars {
		relPath, err := filepath.Rel(cacheDir, path)
		if err != nil {
			return "", fmt.Errorf("error in creating relative path: %w", err)
		}
		relClasspath = append(relClasspath, relPath)
	}

	tmpDir := filepath.Join(cacheDir, "tmpDir")

	if err := extractJar(mainJar, tmpDir); err != nil {
		return "", fmt.Errorf("error in extractJar(): %w", err)
	}

View on GitHub (pinned to 12126d8942)