golang/go · error
reading %s: %v
Error message
reading %s: %v
What it means
GetBytes (cmd/go/internal/web) successfully fetched the URL and Response.Err was nil, but io.ReadAll on the response body failed mid-stream. The %s is the redacted URL; %v is the read error.
Source
Thrown at src/cmd/go/internal/web/api.go:95
return e.Err
}
// GetBytes returns the body of the requested resource, or an error if the
// response status was not http.StatusOK.
//
// GetBytes is a convenience wrapper around Get and Response.Err.
func GetBytes(u *url.URL) ([]byte, error) {
resp, err := Get(DefaultSecurity, u)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if err := resp.Err(); err != nil {
return nil, err
}
b, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("reading %s: %v", u.Redacted(), err)
}
return b, nil
}
type Response struct {
URL string // redacted
Status string
StatusCode int
Header map[string][]string
Body io.ReadCloser // Either the original body or &errorDetail.
fileErr error
errorDetail errorDetailBuffer
}
// Err returns an *HTTPError corresponding to the response r.
// If the response r has StatusCode 200 or 0 (unset), Err returns nil.
// Otherwise, Err may read from r.Body in order to extract relevant error detail.View on GitHub (pinned to b6b368adc5)
Solutions
- Retry the fetch (often transient)
- Verify network stability and proxy timeouts
- Use GOPROXY with retry/backoff; raise server read timeouts for large files
Defensive patterns
Strategy: retry
Prevention
- Retry body reads on transient connection resets
- Use a GOPROXY mirror with retry/backoff for large module downloads
When it happens
Trigger: Connection reset mid-body, truncated/chunked response, or body reader returns an error after headers were received.
Common situations: Flaky networks, CDN dropping the connection, large module zip interrupted, proxy timeout on long downloads.
Related errors
- redirected from secure URL %s to insecure URL %s
- bufio: reader returned negative count from Read
- bufio: writer returned negative count from Write
- bufio.Scanner: token too long
- tls: server sent an unnecessary HelloRetryRequest key_share
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/fcea4eab9cae5482.
Report an issue: GitHub.