{"record":{"id":"1558b8913eafd83e","repo":"golang/go","slug":"goproxy-list-is-not-the-empty-string-but-contains","errorCode":null,"errorMessage":"GOPROXY list is not the empty string, but contains no entries","messagePattern":"GOPROXY list is not the empty string, but contains no entries","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/modfetch/proxy.go","lineNumber":122,"sourceCode":"\t\t\t// Check that newProxyRepo accepts the URL.\n\t\t\t// It won't do anything with the path.\n\t\t\tif _, err := newProxyRepo(url, \"golang.org/x/text\"); err != nil {\n\t\t\t\tproxyOnce.err = err\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tproxyOnce.list = append(proxyOnce.list, proxySpec{\n\t\t\t\turl:             url,\n\t\t\t\tfallBackOnError: fallBackOnError,\n\t\t\t})\n\t\t}\n\n\t\tif len(proxyOnce.list) == 0 ||\n\t\t\tlen(proxyOnce.list) == 1 && proxyOnce.list[0].url == \"noproxy\" {\n\t\t\t// There were no proxies, other than the implicit \"noproxy\" added when\n\t\t\t// GONOPROXY is set. This can happen if GOPROXY is a non-empty string\n\t\t\t// like \",\" or \" \".\n\t\t\tproxyOnce.err = fmt.Errorf(\"GOPROXY list is not the empty string, but contains no entries\")\n\t\t}\n\t})\n\n\treturn proxyOnce.list, proxyOnce.err\n}\n\n// TryProxies iterates f over each configured proxy (including \"noproxy\" and\n// \"direct\" if applicable) until f returns no error or until f returns an\n// error that is not equivalent to fs.ErrNotExist on a proxy configured\n// not to fall back on errors.\n//\n// TryProxies then returns that final error.\n//\n// If GOPROXY is set to \"off\", TryProxies invokes f once with the argument\n// \"off\".\nfunc TryProxies(f func(proxy string) error) error {\n\tproxies, err := proxyList()\n\tif err != nil {","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/modfetch/proxy.go#L104-L140","documentation":"Proxy configuration error: GOPROXY was a non-empty string but after parsing it yields zero real proxies (or only the implicit 'noproxy' entry injected when GONOPROXY is set). Commonly caused by separators with no URL between them.","triggerScenarios":"GOPROXY=\",\", GOPROXY=\" \", or GOPROXY=\",,\" parses to an empty proxy list. The post-parse guard len(proxyOnce.list)==0 fires.","commonSituations":"Shell quoting mistake when exporting GOPROXY; CI templating that joins an empty proxy list with commas; copy-paste from docs leaving a trailing comma; env file with stray whitespace.","solutions":["Set a valid GOPROXY: export GOPROXY=https://proxy.golang.org,direct.","Strip stray separators and whitespace: echo \"$GOPROXY\" | tr ',' '\\n' | grep -v '^[[:space:]]*$'.","To genuinely disable proxies, set GOPROXY=direct, not an empty-comma value.","Audit your Dockerfile / CI matrix and env files for malformed GOPROXY."],"exampleFix":"// before\n//   export GOPROXY=,\n// after\n//   export GOPROXY=https://proxy.golang.org,direct","handlingStrategy":"validation","validationCode":"func validateGOPROXY(s string) error {\n    s = strings.TrimSpace(s)\n    if s == \"\" { return nil }\n    var n int\n    for _, e := range strings.Split(s, \",\") {\n        e = strings.TrimSpace(e)\n        if e == \"\" { continue }\n        if e == \"direct\" || e == \"off\" || strings.Contains(e, \"://\") || strings.HasPrefix(e, \"file:\") { n++ }\n    }\n    if n == 0 { return fmt.Errorf(\"GOPROXY %q has no usable entries\", s) }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set GOPROXY explicitly in CI from a known-good template rather than string concatenation.","To disable proxies use GOPROXY=direct or GOPROXY=off, never empty comma values."],"tags":["goproxy","config","environment"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}