golang/go · error
cannot parse GOAUTH command %s: %v
Error message
cannot parse GOAUTH command %s: %v
What it means
Raised by buildCommand when quoted.Split(command) fails to parse the GOAUTH command string with Go's shell-like quoting rules. The %s is the offending command string, %v the quoted.Split error (typically an unclosed quote or invalid escape). This happens before any process is started.
Source
Thrown at src/cmd/go/internal/auth/userauth.go:110
}
return credentials, nil
}
// mapHeadersToPrefixes returns a mapping of prefix → http.Header without
// the leading "https://".
func mapHeadersToPrefixes(prefixes []string, header http.Header) map[string]http.Header {
prefixToHeaders := make(map[string]http.Header, len(prefixes))
for _, p := range prefixes {
p = strings.TrimPrefix(p, "https://")
prefixToHeaders[p] = header.Clone() // Clone the header to avoid sharing
}
return prefixToHeaders
}
func buildCommand(command string) (*exec.Cmd, error) {
words, err := quoted.Split(command)
if err != nil {
return nil, fmt.Errorf("cannot parse GOAUTH command %s: %v", command, err)
}
cmd := exec.Command(words[0], words[1:]...)
return cmd, nil
}
// writeResponseToStdin writes the HTTP response to the command's stdin.
func writeResponseToStdin(cmd *exec.Cmd, res *http.Response) error {
var output strings.Builder
output.WriteString(res.Proto + " " + res.Status + "\n")
for k, v := range res.Header {
output.WriteString(k + ": " + strings.Join(v, ", ") + "\n")
}
output.WriteString("\n")
cmd.Stdin = strings.NewReader(output.String())
return nil
}
View on GitHub (pinned to b6b368adc5)
Solutions
- Balance all quotes in the GOAUTH value.
- Quote paths containing spaces with single quotes: `GOAUTH='/path with spaces/auth'`.
- Inspect the resolved value: `go env GOAUTH`.
- Avoid unnecessary nesting of quotes; prefer one quoting style.
Example fix
// before GOAUTH='my-auth "cmd' // after GOAUTH='my-auth "cmd"'
Defensive patterns
Strategy: validation
Validate before calling
// Validate the GOAUTH command string parses before the go command reads it.
if _, err := quoted.Split(os.Getenv("GOAUTH")); err != nil {
return fmt.Errorf("GOAUTH has unbalanced quoting: %w", err)
} Prevention
- Balance all quotes in the GOAUTH value.
- Inspect the resolved value with `go env GOAUTH`.
- Use a single consistent quoting style for paths with spaces.
When it happens
Trigger: The GOAUTH environment variable contains a command string with unbalanced single or double quotes, or an invalid backslash escape that quoted.Split rejects.
Common situations: An unclosed quote such as `GOAUTH='my-auth "cmd'`; a Windows path with an unquoted trailing backslash; mixed quote styles; a value built by string concatenation that drops a closing quote.
Related errors
- GOAUTH=%s: %v
- no explicit url was passed
- 'git credential fill' failed (url=%s): %w %s
- 'git credential fill' failed for url=%s, could not parse url
- requested a credential for %s, but 'git credential fill' pro
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/5bfac4ae713ba600.
Report an issue: GitHub.