apache/beam · error
failed to connect to
Error message
failed to connect to %v: received non 200 response code, got %v
What it means
getLocalJar downloads the Java expansion service jar over HTTP and requires HTTP 200. Any other status (403, 404, 5xx, redirect handled as 3xx) aborts the download with this error before the jar file is created. It exists to fail fast with a clear message instead of writing an HTML error page into a .jar file.
Solutions
- Print/verify the exact URL and open it in a browser or `curl -I` to see the real status code.
- If 404: update the Beam version or jar URL to the published artifact location.
- If 403: add authentication to the artifact repository or use a mirror you can access.
- If 5xx: retry later or pre-download the jar locally and point the pipeline at the local copy.
Example fix
// before
// jar auto-downloaded from a pinned, now-dead URL
// after: pre-download or verify availability
resp, _ := http.Head(jarURL)
if resp == nil || resp.StatusCode != 200 {
log.Fatalf("jar not reachable (%s): status %v", jarURL, resp.StatusCode)
} Defensive patterns
Strategy: validation
Validate before calling
resp, err := http.Head(url)
if err != nil || resp.StatusCode != 200 {
return fmt.Errorf("jar URL %s not reachable (status %v)", url, resp.StatusCode)
} Try / catch
jarPath, err := expansionx.MakeJar(ctx, url, dest)
if err != nil && strings.Contains(err.Error(), "non 200 response code") {
// fall back to mirror URL or pre-downloaded local jar
jarPath, err = expansionx.MakeJar(ctx, mirrorURL, dest)
} Prevention
- curl -I the jar URL during environment setup to catch 403/404 early.
- Pin jar URLs to versions you control or host the jar in an internal mirror.
- Check Beam release notes for artifact relocation when upgrading versions.
- Add proxy/auth configuration for artifact repositories in corporate environments.
When it happens
Trigger: getLocalJar (via MakeJar) performs http.Get(url) and resp.StatusCode != 200 — a bad or moved jar URL, auth-protected artifact repository, or server outage.
Common situations: Artifact repository requires credentials so the CDN returns 403; jar was published under a new Beam version so the pinned URL 404s; corporate proxy blocks the download; transient 502/503 from the artifact host.
Related errors
- Artifact not found at
- error in coping file
- read resource request returned error on input
- chunk send failed
- could not create data operations client
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/244128cbea28a036.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go:126
}
// Issue warning when downloading from public repositories
if strings.Contains(url, "repo.maven.apache.org") ||
strings.Contains(url, "repo1.maven.org") ||
strings.Contains(url, "maven.google.com") ||
strings.Contains(url, "maven-central.storage-download.googleapis.com") {
log.Printf("WARNING: Downloading JAR file from public repository: %s. "+
"This may pose security risks or cause instability due to repository availability. Consider pre-staging dependencies or using private mirrors.", url)
}
resp, err := http.Get(string(url))
if err != nil {
return "", err
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
return "", fmt.Errorf("failed to connect to %v: received non 200 response code, got %v", url, resp.StatusCode)
}
file, err := os.Create(jarPath)
if err != nil {
return "", fmt.Errorf("error in creating jar %s: %w", jarPath, err)
}
_, err = io.Copy(file, resp.Body)
if err != nil {
return "", fmt.Errorf("error in coping file %s inside jar %s: %w", file.Name(), jarPath, err)
}
return jarPath, nil
}
func validatePath(dest, filename string) (string, error) {
destPath := filepath.Join(dest, filename)
cleanDest := filepath.Clean(dest)View on GitHub (pinned to 12126d8942)