apache/beam · error
repo URL does not have an http or https prefix
Error message
repo URL %v does not have an http or https prefix
What it means
jarGetter.setRepositoryURL validates that the provided repository URL starts with "http" and rejects anything else. This guards against malformed or scheme-less repository addresses that would break JAR download URL construction.
Solutions
- Prefix the repository address with https:// (or http:// for plain-HTTP internal repos).
- Trim whitespace and stray quotes from the configured URL.
- Use https://repo.maven.apache.org/maven2 or https://packages.apache.org/maven-snapshot-repository for Beam artifacts.
- Validate the URL in your configuration before calling the expansion service setup.
Example fix
// before
getter.setRepositoryURL("repo.maven.apache.org/maven2")
// after
getter.setRepositoryURL("https://repo.maven.apache.org/maven2") Defensive patterns
Strategy: validation
Validate before calling
func validRepoURL(u string) bool {
return strings.HasPrefix(u, "http://") || strings.HasPrefix(u, "https://")
}
// call before configuring the getter
if !validRepoURL(cfg.RepoURL) {
return fmt.Errorf("repo URL %q must start with http(s)://", cfg.RepoURL)
} Try / catch
if err := getter.setRepositoryURL(repoURL); err != nil {
return fmt.Errorf("bad repo URL %q: %w", repoURL, err)
} Prevention
- Always include the scheme (https://) in repository configuration.
- Trim whitespace/quotes from config values before use.
- Lint repo URLs at config load time.
When it happens
Trigger: Calling setRepositoryURL (directly or via the jarGetter configuration path in expansionx, e.g. NewJarGetter/GetBeamJar options) with a URL like "repo.example.com/beam" lacking an http/https prefix, or with ftp://, file:// etc.
Common situations: Configuring a custom Maven/Nexus repository without the scheme; typo like "htp://"; passing an empty or placeholder repo URL from config.
Understand the failure class
Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.
Related errors
- bucket must be non-empty
- bucket must not be empty
- EnableHeapCaptureHook
- EnableProfCaptureHook
- EnableTraceCaptureHook
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/c0ee581699d059fc.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go:336
}
return tmpJar, nil
}
// GetBeamJar checks a temporary directory for the desired Beam JAR, downloads the
// appropriate JAR from Maven if not present, then returns the file path to the
// JAR.
func GetBeamJar(gradleTarget, version string) (string, error) {
return defaultJarGetter.getJar(gradleTarget, version)
}
func (j *jarGetter) getRepositoryURL() string {
return string(j.repository)
}
func (j *jarGetter) setRepositoryURL(repoURL string) error {
if !strings.HasPrefix(repoURL, "http") {
return fmt.Errorf("repo URL %v does not have an http or https prefix", repoURL)
}
j.repository = url(strings.TrimSuffix(repoURL, "/"))
return nil
}
func (j *jarGetter) getJar(gradleTarget, version string) (string, error) {
strippedTarget := dropEndOfGradleTarget(gradleTarget)
fullURL, jarName := j.getURLForBeamJar(strippedTarget, version)
err := os.MkdirAll(j.jarCache, 0700)
if err != nil {
return "", err
}
jarPath := filepath.Join(j.jarCache, jarName)
if jarExists(jarPath) {
return jarPath, nilView on GitHub (pinned to 12126d8942)