{"record":{"id":"f41952bcd54d4924","repo":"golang/go","slug":"invalid-proxy-url-missing-scheme-s","errorCode":null,"errorMessage":"invalid proxy URL missing scheme: %s","messagePattern":"invalid proxy URL missing scheme: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/modfetch/proxy.go","lineNumber":211,"sourceCode":"\tlistLatestErr  error\n}\n\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","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/modfetch/proxy.go#L193-L229","documentation":"newProxyRepo rejects a proxy URL whose parsed scheme is empty. The go command needs to know which transport to use (http, https, or file), so a bare hostname or path is not acceptable.","triggerScenarios":"GOPROXY entry like `proxy.local` or `/cache` with no scheme. url.Parse succeeds but base.Scheme == \"\".","commonSituations":"Typing a hostname without https://; templated GOPROXY that drops the scheme; migrating from a config format that omitted schemes.","solutions":["Prefix the entry with https:// (preferred) or http://.","For a local directory cache use file:///path.","Validate every comma-separated GOPROXY entry has an explicit scheme before running go."],"exampleFix":"// before\n//   GOPROXY=proxy.corp.com,direct\n// after\n//   GOPROXY=https://proxy.corp.com,direct","handlingStrategy":"validation","validationCode":"func validateProxyEntry(s string) error {\n    if s == \"direct\" || s == \"off\" { return nil }\n    u, err := url.Parse(strings.TrimSpace(s))\n    if err != nil { return err }\n    if u.Scheme == \"\" { return fmt.Errorf(\"proxy URL %q missing scheme\", s) }\n    return nil\n}","typeGuard":"func hasProxyScheme(s string) bool {\n    u, err := url.Parse(strings.TrimSpace(s))\n    return err == nil && (u.Scheme == \"http\" || u.Scheme == \"https\" || u.Scheme == \"file\")\n}","tryCatchPattern":null,"preventionTips":["Always include https:// (or http://, file://) in every GOPROXY entry.","Lint GOPROXY in shell startup scripts."],"tags":["goproxy","config","url","scheme"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}