coreybutler/nvm-windows · error
error reading HTTP request body: %v
Error message
error reading HTTP request body: %v
What it means
After a 200 response, GetRemoteTextFile reads the full body with ioutil.ReadAll. This error means the body stream failed mid-read — the connection was reset, the server/CDN closed early, a proxy timed out, or the declared Content-Length could not be fulfilled. Connectivity was fine at request time; the transfer broke afterwards.
Source
Thrown at src/web/web.go:365
return false
}
}
func GetRemoteTextFile(url string) (string, error) {
response, httperr := client.Get(url)
if httperr != nil {
return "", fmt.Errorf("Could not retrieve %v: %v", url, httperr)
}
if response.StatusCode != 200 {
return "", fmt.Errorf("Error retrieving \"%s\": HTTP Status %v\n", url, response.StatusCode)
}
defer response.Body.Close()
contents, readerr := ioutil.ReadAll(response.Body)
if readerr != nil {
return "", fmt.Errorf("error reading HTTP request body: %v", readerr)
}
return string(contents), nil
}
func IsNode64bitAvailable(v string) bool {
if v == "latest" {
return true
}
// Anything below version 8 doesn't have a 64 bit version
vers := strings.Fields(strings.Replace(v, ".", " ", -1))
main, _ := strconv.ParseInt(vers[0], 0, 0)
minor, _ := strconv.ParseInt(vers[1], 0, 0)
if main == 0 && minor < 8 {
return false
}
View on GitHub (pinned to 5b18223ca1)
Solutions
- Retry the nvm command — transient resets are the most common cause.
- Switch to a closer/faster mirror to shorten transfer time (npmmirror etc.).
- If behind a proxy, check its body/idle timeout settings or bypass it for the mirror domain.
- Stabilize the underlying network (VPN, DNS, Wi-Fi) before large downloads.
Defensive patterns
Strategy: retry
Try / catch
var body string
var err error
for i := 0; i < 3; i++ {
body, err = web.GetRemoteTextFile(url)
if err == nil || !strings.Contains(err.Error(), "reading HTTP request body") { break }
time.Sleep(time.Duration(i+1) * time.Second)
} Prevention
- Retry body-read failures — they are usually transient connection resets.
- Use a closer mirror to shorten transfer windows.
- Check proxy idle/body timeouts on managed networks.
When it happens
Trigger: GET succeeds but the connection drops while streaming the index JSON or file body: flaky Wi-Fi/VPN, aggressive proxy idle timeouts, server closing keep-alive connections early, or very large bodies over unreliable links.
Common situations: Slow networks fetching node's index.json; corporate proxies with short body timeouts; mobile/tethered connections resetting mid-transfer; CDN edge nodes dropping long transfers.
Related errors
- error: received status code %d
- Could not retrieve %v: %v
- Error retrieving "%s": HTTP Status %v
- failed to download v%v arm 64-bit executable
- Failed to extract npm: %v
AI-assisted analysis of coreybutler/nvm-windows@5b18223ca1 (2026-08-15).
Data as JSON: /api/errors/5cdc420eb3cb69cd.
Report an issue: GitHub.