{"record":{"id":"04617cb9acb21187","repo":"golang/go","slug":"s-w","errorCode":null,"errorMessage":"%s: %w","messagePattern":"%s: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/load/pkg.go","lineNumber":3436,"sourceCode":"\tpatterns = search.CleanPatterns(patterns)\n\n\t// Query the module providing the first argument, load its go.mod file, and\n\t// check that it doesn't contain directives that would cause it to be\n\t// interpreted differently if it were the main module.\n\t//\n\t// If multiple modules match the first argument, accept the longest match\n\t// (first result). It's possible this module won't provide packages named by\n\t// later arguments, and other modules would. Let's not try to be too\n\t// magical though.\n\tallowed := ld.CheckAllowed\n\tif modload.IsRevisionQuery(firstPath, version) {\n\t\t// Don't check for retractions if a specific revision is requested.\n\t\tallowed = nil\n\t}\n\tnoneSelected := func(path string) (version string) { return \"none\" }\n\tqrs, err := modload.QueryPackages(ld, ctx, patterns[0], version, noneSelected, allowed)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", args[0], err)\n\t}\n\trootMod := qrs[0].Mod\n\tdeprecation, err := modload.CheckDeprecation(ld, ctx, rootMod)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", args[0], err)\n\t}\n\tif deprecation != \"\" {\n\t\tfmt.Fprintf(os.Stderr, \"go: module %s is deprecated: %s\\n\", rootMod.Path, modload.ShortMessage(deprecation, \"\"))\n\t}\n\tdata, err := ld.Fetcher().GoMod(ctx, rootMod.Path, rootMod.Version)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", args[0], err)\n\t}\n\tf, err := modfile.Parse(\"go.mod\", data, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s (in %s): %w\", args[0], rootMod, err)\n\t}\n\tdirectiveFmt := \"%s (in %s):\\n\" +","sourceCodeStart":3418,"sourceCodeEnd":3454,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/load/pkg.go#L3418-L3454","documentation":"Wraps any error from `modload.QueryPackages` when resolving the first `package@version` argument against the module proxy or VCS. This is the primary module-resolution step; failures include module-not-found, version-not-found, network errors, and checksum/sumdb mismatches. The original argument is prefixed so the user sees which input failed.","triggerScenarios":"`go install example.com/nonexistent@v1.0.0`; offline network; `GOPROXY=off`; `GOPRIVATE` misconfigured so a private module is queried against the public proxy and rejected; a tag that does not exist.","commonSituations":"Typo in module path or version, network/proxy outage, air-gapped environment, private repo auth not configured, sumdb verification failure for a private module.","solutions":["Verify the exact module path and version tag exist (check the registry/VCS).","Inspect proxy/network config: `go env GOPROXY GOSUMDB GOPRIVATE` and set `GOPRIVATE` for private modules.","Reproduce the underlying error with `go mod download <module>@<version>` for a clearer message.","Retry after `go clean -modcache` if the cache appears corrupt."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Validate reachability before the real command.\nfunc checkModuleResolvable(mod, ver string) error {\n    cmd := exec.Command(\"go\", \"mod\", \"download\", mod+\"@\"+ver)\n    return cmd.Run()\n}","typeGuard":null,"tryCatchPattern":"// Retry transient proxy/network failures with backoff.\nvar lastErr error\nfor i := 0; i < 3; i++ {\n    err := runGoInstall(modAtVersion)\n    if err == nil { return nil }\n    lastErr = err\n    if !isTransientProxyErr(err) { break }\n    time.Sleep(time.Duration(1<<i) * time.Second)\n}\nreturn lastErr","preventionTips":["Set GOPRIVATE for private modules so they bypass the public proxy.","Verify the module path/version against the VCS or registry before scripting installs.","Run `go mod download pkg@ver` first to surface the underlying proxy error."],"tags":["go-toolchain","module","network","proxy","install"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}