{"record":{"id":"5cdc420eb3cb69cd","repo":"coreybutler/nvm-windows","slug":"error-reading-http-request-body-v","errorCode":null,"errorMessage":"error reading HTTP request body: %v","messagePattern":"error reading HTTP request body: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/web/web.go","lineNumber":365,"sourceCode":"\t\treturn false\n\t}\n}\n\nfunc GetRemoteTextFile(url string) (string, error) {\n\tresponse, httperr := client.Get(url)\n\tif httperr != nil {\n\t\treturn \"\", fmt.Errorf(\"Could not retrieve %v: %v\", url, httperr)\n\t}\n\n\tif response.StatusCode != 200 {\n\t\treturn \"\", fmt.Errorf(\"Error retrieving \\\"%s\\\": HTTP Status %v\\n\", url, response.StatusCode)\n\t}\n\n\tdefer response.Body.Close()\n\n\tcontents, readerr := ioutil.ReadAll(response.Body)\n\tif readerr != nil {\n\t\treturn \"\", fmt.Errorf(\"error reading HTTP request body: %v\", readerr)\n\t}\n\n\treturn string(contents), nil\n}\n\nfunc IsNode64bitAvailable(v string) bool {\n\tif v == \"latest\" {\n\t\treturn true\n\t}\n\n\t// Anything below version 8 doesn't have a 64 bit version\n\tvers := strings.Fields(strings.Replace(v, \".\", \" \", -1))\n\tmain, _ := strconv.ParseInt(vers[0], 0, 0)\n\tminor, _ := strconv.ParseInt(vers[1], 0, 0)\n\tif main == 0 && minor < 8 {\n\t\treturn false\n\t}\n","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/coreybutler/nvm-windows/blob/5b18223ca19ff50d707f35410dbc6bd440a9f74d/src/web/web.go#L347-L383","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"var body string\nvar err error\nfor i := 0; i < 3; i++ {\n    body, err = web.GetRemoteTextFile(url)\n    if err == nil || !strings.Contains(err.Error(), \"reading HTTP request body\") { break }\n    time.Sleep(time.Duration(i+1) * time.Second)\n}","preventionTips":["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."],"tags":["network","http","io","connection-reset","timeout"],"backgroundTag":null,"analyzedSha":"5b18223ca19ff50d707f35410dbc6bd440a9f74d","analyzedAt":"2026-08-15T10:06:51.428Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}