{"record":{"id":"c72bcdacb32736a2","repo":"golang/go","slug":"goauth-s-v","errorCode":null,"errorMessage":"GOAUTH=%s: %v","messagePattern":"GOAUTH=(.+?): (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/cmd/go/internal/auth/auth.go","lineNumber":74,"sourceCode":"\t// The GOAUTH commands are processed in reverse order to prioritize\n\t// credentials in the order they were specified.\n\tslices.Reverse(goAuthCmds)\n\tfor _, command := range goAuthCmds {\n\t\tcommand = strings.TrimSpace(command)\n\t\twords := strings.Fields(command)\n\t\tif len(words) == 0 {\n\t\t\tbase.Fatalf(\"go: GOAUTH encountered an empty command (GOAUTH=%s)\", cfg.GOAUTH)\n\t\t}\n\t\tswitch words[0] {\n\t\tcase \"off\":\n\t\t\tif len(goAuthCmds) != 1 {\n\t\t\t\tbase.Fatalf(\"go: GOAUTH=off cannot be combined with other authentication commands (GOAUTH=%s)\", cfg.GOAUTH)\n\t\t\t}\n\t\t\treturn\n\t\tcase \"netrc\":\n\t\t\tlines, err := readNetrc()\n\t\t\tif err != nil {\n\t\t\t\tcmdErrs = append(cmdErrs, fmt.Errorf(\"GOAUTH=%s: %v\", command, err))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Process lines in reverse so that if the same machine is listed\n\t\t\t// multiple times, we end up saving the earlier one\n\t\t\t// (overwriting later ones). This matches the way the go command\n\t\t\t// worked before GOAUTH.\n\t\t\tfor i := len(lines) - 1; i >= 0; i-- {\n\t\t\t\tl := lines[i]\n\t\t\t\tr := http.Request{Header: make(http.Header)}\n\t\t\t\tr.SetBasicAuth(l.login, l.password)\n\t\t\t\tstoreCredential(l.machine, r.Header)\n\t\t\t}\n\t\tcase \"git\":\n\t\t\tif len(words) != 2 {\n\t\t\t\tbase.Fatalf(\"go: GOAUTH=git dir method requires an absolute path to the git working directory\")\n\t\t\t}\n\t\t\tdir := words[1]\n\t\t\tif !filepath.IsAbs(dir) {","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/auth/auth.go#L56-L92","documentation":"Emitted from the `netrc` branch of runGoAuth when readNetrc() returns an error. The error is non-fatal: it is appended to cmdErrs and only logged (under `go -x`) if no GOAUTH command ultimately supplies a credential for the URL. The %s is the command token (netrc) and %v is the underlying readNetrc error (permission denied, parse error, missing HOME).","triggerScenarios":"GOAUTH contains `netrc` and readNetrc() fails: ~/.netrc (or _netrc on Windows) is unreadable due to permissions, missing, or syntactically malformed, or HOME is unset so the path cannot be resolved.","commonSituations":"~/.netrc with overly permissive or restrictive permissions (many tools require 0600); a netrc with a token sequence netrc cannot parse; HOME unset in a container/CI; netrc pointing at a private repo that requires a credential netrc can't supply.","solutions":["Verify ~/.netrc exists and is owner-readable: `chmod 600 ~/.netrc`.","Validate netrc syntax: each `machine <host>` (or `default`) entry followed by `login <u>` and `password <p>`.","Ensure HOME is set (`echo $HOME`) so the netrc path resolves.","Run `go get -x <url>` to surface the deferred error message.","If netrc is unnecessary, remove `netrc` from the GOAUTH list."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate netrc readability and basic syntax before relying on GOAUTH=netrc.\nhome, err := os.UserHomeDir()\nif err != nil { return err }\np := filepath.Join(home, \".netrc\")\ninfo, err := os.Stat(p)\nif err == nil && info.Mode().Perm()&0077 != 0 {\n    return fmt.Errorf(\"%s permissions too open; chmod 600\", p)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep ~/.netrc at 0600.","Ensure each machine/default entry has both login and password.","Run `go get -x` to surface deferred GOAUTH errors.","Set HOME explicitly in containers/CI."],"tags":["go-toolchain","goauth","netrc","authentication","credentials","non-fatal"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}