{"record":{"id":"66b241e2db8f5781","repo":"golang/go","slug":"invalid-proxy-url-scheme-must-be-https-http-fil","errorCode":null,"errorMessage":"invalid proxy URL scheme (must be https, http, file): %s","messagePattern":"invalid proxy URL scheme \\(must be https, http, file\\): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/modfetch/proxy.go","lineNumber":213,"sourceCode":"\nfunc newProxyRepo(baseURL, path string) (Repo, error) {\n\t// Parse the base proxy URL.\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tredactedBase := base.Redacted()\n\tswitch base.Scheme {\n\tcase \"http\", \"https\":\n\t\t// ok\n\tcase \"file\":\n\t\tif *base != (url.URL{Scheme: base.Scheme, Path: base.Path, RawPath: base.RawPath}) {\n\t\t\treturn nil, fmt.Errorf(\"invalid file:// proxy URL with non-path elements: %s\", redactedBase)\n\t\t}\n\tcase \"\":\n\t\treturn nil, fmt.Errorf(\"invalid proxy URL missing scheme: %s\", redactedBase)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid proxy URL scheme (must be https, http, file): %s\", redactedBase)\n\t}\n\n\t// Append the module path to the URL.\n\turl := base\n\tenc, err := module.EscapePath(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\turl.Path = strings.TrimSuffix(base.Path, \"/\") + \"/\" + enc\n\turl.RawPath = strings.TrimSuffix(base.RawPath, \"/\") + \"/\" + pathEscape(enc)\n\n\treturn &proxyRepo{url, path, redactedBase, sync.Once{}, nil, nil}, nil\n}\n\nfunc (p *proxyRepo) ModulePath() string {\n\treturn p.path\n}\n","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/modfetch/proxy.go#L195-L231","documentation":"newProxyRepo rejects any proxy URL scheme that is not http, https, or file. Schemes like ftp, ssh, gopher, git, ws fall through the switch to the default branch.","triggerScenarios":"GOPROXY entry begins with an unsupported scheme such as ftp://, git://, or ssh://. base.Scheme is non-empty but none of the three accepted cases.","commonSituations":"Pointing GOPROXY at a raw git URL instead of an HTTPS module proxy; copy-paste of a VCS clone URL; misconfiguration expecting the go command to fetch via git protocol.","solutions":["Use a real HTTPS Go module proxy, or 'direct' to fetch from VCS over the supported VCS protocols (separate from GOPROXY scheme rules).","Self-host goproxy or Athens and point GOPROXY at its https:// endpoint.","Drop unsupported schemes from the list entirely."],"exampleFix":"// before\n//   GOPROXY=git://github.com,direct\n// after\n//   GOPROXY=https://proxy.golang.org,direct","handlingStrategy":"validation","validationCode":"func validateProxyScheme(s string) error {\n    u, err := url.Parse(strings.TrimSpace(s))\n    if err != nil { return err }\n    switch u.Scheme {\n    case \"http\", \"https\", \"file\": return nil\n    case \"\": return fmt.Errorf(\"missing scheme\")\n    default: return fmt.Errorf(\"unsupported scheme %q\", u.Scheme)\n    }\n}","typeGuard":"func hasAllowedProxyScheme(s string) bool {\n    u, err := url.Parse(strings.TrimSpace(s))\n    if err != nil { return false }\n    switch u.Scheme {\n    case \"http\", \"https\", \"file\": return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Use only http/https/file for GOPROXY entries.","For raw VCS access use GOPROXY=direct rather than git:// or ssh://."],"tags":["goproxy","config","url","scheme"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}