{"record":{"id":"c0ee581699d059fc","repo":"apache/beam","slug":"repo-url-v-does-not-have-an-http-or-https-prefix","errorCode":null,"errorMessage":"repo URL %v does not have an http or https prefix","messagePattern":"repo URL (.+?) does not have an http or https prefix","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go","lineNumber":336,"sourceCode":"\t}\n\n\treturn tmpJar, nil\n}\n\n// GetBeamJar checks a temporary directory for the desired Beam JAR, downloads the\n// appropriate JAR from Maven if not present, then returns the file path to the\n// JAR.\nfunc GetBeamJar(gradleTarget, version string) (string, error) {\n\treturn defaultJarGetter.getJar(gradleTarget, version)\n}\n\nfunc (j *jarGetter) getRepositoryURL() string {\n\treturn string(j.repository)\n}\n\nfunc (j *jarGetter) setRepositoryURL(repoURL string) error {\n\tif !strings.HasPrefix(repoURL, \"http\") {\n\t\treturn fmt.Errorf(\"repo URL %v does not have an http or https prefix\", repoURL)\n\t}\n\tj.repository = url(strings.TrimSuffix(repoURL, \"/\"))\n\treturn nil\n}\n\nfunc (j *jarGetter) getJar(gradleTarget, version string) (string, error) {\n\tstrippedTarget := dropEndOfGradleTarget(gradleTarget)\n\tfullURL, jarName := j.getURLForBeamJar(strippedTarget, version)\n\n\terr := os.MkdirAll(j.jarCache, 0700)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tjarPath := filepath.Join(j.jarCache, jarName)\n\n\tif jarExists(jarPath) {\n\t\treturn jarPath, nil","sourceCodeStart":318,"sourceCodeEnd":354,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go#L318-L354","documentation":"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.","triggerScenarios":"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.","commonSituations":"Configuring a custom Maven/Nexus repository without the scheme; typo like \"htp://\"; passing an empty or placeholder repo URL from config.","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."],"exampleFix":"// before\ngetter.setRepositoryURL(\"repo.maven.apache.org/maven2\")\n// after\ngetter.setRepositoryURL(\"https://repo.maven.apache.org/maven2\")","handlingStrategy":"validation","validationCode":"func validRepoURL(u string) bool {\n    return strings.HasPrefix(u, \"http://\") || strings.HasPrefix(u, \"https://\")\n}\n// call before configuring the getter\nif !validRepoURL(cfg.RepoURL) {\n    return fmt.Errorf(\"repo URL %q must start with http(s)://\", cfg.RepoURL)\n}","typeGuard":null,"tryCatchPattern":"if err := getter.setRepositoryURL(repoURL); err != nil {\n    return fmt.Errorf(\"bad repo URL %q: %w\", repoURL, err)\n}","preventionTips":["Always include the scheme (https://) in repository configuration.","Trim whitespace/quotes from config values before use.","Lint repo URLs at config load time."],"tags":["go","url-validation","configuration","repository"],"backgroundTag":"invalid-url-format","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"}