apache/beam · error
source path doesn't exist
Error message
source path %s doesn't exist: %w
What it means
packJar failed at os.Stat(source): the directory or file being repacked into the JAR does not exist (or is inaccessible). This happens after the destination jar was already created, so a partial/empty jar file may be left on disk. The underlying os.Stat error is wrapped with the source path.
Solutions
- Verify the source path exists with ls before packing; recreate it (re-run extractJar on the main JAR).
- Remove stale tmpDir under the jar cache and retry so extraction recreates it.
- Avoid concurrent processes sharing the same jar cache directory.
- If calling packJar directly, validate os.Stat(source) yourself first and fail early.
Example fix
// before
packJar(tmpDir, outJar)
// after
if _, err := os.Stat(tmpDir); err != nil {
return fmt.Errorf("source %s missing: %w", tmpDir, err)
}
packJar(tmpDir, outJar) Defensive patterns
Strategy: validation
Validate before calling
if _, err := os.Stat(source); err != nil {
return fmt.Errorf("source %s unavailable: %w", source, err)
} Try / catch
if err := packJar(source, dest); err != nil {
if errors.Is(err, fs.ErrNotExist) {
// recreate source tree (re-run extractJar) and retry once
}
return err
} Prevention
- Always run extractJar successfully before packJar; check its error.
- Never share/mutate the tmpDir from concurrent processes.
- Recreate the cache dir rather than assuming it persists across runs.
- Validate source existence at the start of MakeJar.
When it happens
Trigger: packJar(source, dest) is called with a source path that was deleted, never created, or is unreadable — e.g. the tmpDir produced by extractJar was removed, or MakeJar was pointed at a mainJar that failed to extract fully.
Common situations: Stale or concurrently deleted ~/.beam661bea09-.../tmpDir; another process cleaned the cache mid-run; typo'd path passed to a custom caller of packJar; extractJar failed silently earlier leaving no tmpDir.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- error in creating relative path
- error creating jar packJar
- error opening destination file
- error opening file
- can't change to old working directory
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/e47c8e270dcf8a42.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go:205
return err
}
}
return nil
}
func packJar(source, dest string) error {
jar, err := os.Create(dest)
if err != nil {
return fmt.Errorf("error creating jar packJar(%s,%s)=%w", source, dest, err)
}
defer jar.Close()
jarFile := zip.NewWriter(jar)
defer jarFile.Close()
fileInfo, err := os.Stat(source)
if err != nil {
return fmt.Errorf("source path %s doesn't exist: %w", source, err)
}
var sourceDir string
if fileInfo.IsDir() {
sourceDir = filepath.Base(source)
}
err = filepath.Walk(source, func(path string, fileInfo os.FileInfo, err error) error {
if err != nil {
return fmt.Errorf("error accesing path %s: %w", path, err)
}
fileHeader, err := zip.FileInfoHeader(fileInfo)
if err != nil {
return fmt.Errorf("error getting FileInfoHeader: %w", err)
}
if sourceDir != "" {
fileHeader.Name = filepath.Join(sourceDir, strings.TrimPrefix(path, source))View on GitHub (pinned to 12126d8942)