{"record":{"id":"186aa2bd1fb4e6f9","repo":"coreybutler/nvm-windows","slug":"could-not-retrieve-v-v","errorCode":null,"errorMessage":"Could not retrieve %v: %v","messagePattern":"Could not retrieve (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/web/web.go","lineNumber":354,"sourceCode":"\t\t}\n\t}\n\tfileName := tempDir + \"\\\\\" + \"npm-v\" + v + \".zip\"\n\n\tfmt.Printf(\"Downloading npm version \" + v + \"... \")\n\tif Download(url, fileName, v) {\n\t\tutility.DebugLog(\"npm download succeeded\")\n\t\tfmt.Printf(\"Complete\\n\")\n\t\treturn true\n\t} else {\n\t\tutility.DebugLog(\"npm download failed\")\n\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\" {","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/coreybutler/nvm-windows/blob/5b18223ca19ff50d707f35410dbc6bd440a9f74d/src/web/web.go#L336-L372","documentation":"GetRemoteTextFile(url) performs an HTTP GET using nvm-windows' shared web client. This error means the request itself failed before any response arrived — DNS resolution failure, TCP connection refused/timeout, TLS handshake error, or proxy misconfiguration. The wrapped error (and URL) in the message identify which link failed.","triggerScenarios":"GetRemoteTextFile hitting node/npm mirror index files (e.g. https://nodejs.org/dist/index.json or a configured mirror) when the machine is offline, the mirror domain is blocked/unreachable, a corporate proxy is required but not set (nvm proxy setting), or verifyssl rejects a self-signed TLS intercept.","commonSituations":"Users in regions where nodejs.org is slow/blocked setting NVM_NODE_MIRROR to taobao/npmmirror; corporate TLS-intercepting proxies without setting 'nvm proxy'; DNS or VPN outages; typo'd mirror URL from 'nvm node_mirror'.","solutions":["Check the wrapped error: 'dial tcp: lookup ... no such host' means DNS — fix connectivity or the mirror URL.","If behind a corporate proxy, configure it: nvm proxy <http://user:pass@host:port>.","If TLS errors appear, verify the mirror URL uses a valid certificate, or (with understood risk) 'nvm off' verifyssl equivalent — set ssl_verify off in settings.txt only if your network intercepts TLS.","Switch to a reachable mirror: set NVM_NODE_MIRROR / use nvm's mirror commands (e.g. https://npmmirror.com/mirrors/node)."],"exampleFix":"// before\nresponse, httperr := client.Get(url)\nif httperr != nil {\n    return \"\", fmt.Errorf(\"Could not retrieve %v: %v\", url, httperr)\n}\n\n// after: include operation hints in the message\nresponse, httperr := client.Get(url)\nif httperr != nil {\n    return \"\", fmt.Errorf(\"could not retrieve %v (check network/proxy/mirror settings): %w\", url, httperr)\n}","handlingStrategy":"retry","validationCode":"// Validate connectivity/URL before calling GetRemoteTextFile\nu, err := url.Parse(mirrorURL)\nif err != nil || (u.Scheme != \"http\" && u.Scheme != \"https\") { return errors.New(\"bad mirror URL\") }\nconn, err := net.DialTimeout(\"tcp\", net.JoinHostPort(u.Hostname(), port(u)), 5*time.Second)\nif err != nil { return fmt.Errorf(\"mirror unreachable: %w\", err) }\nconn.Close()","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 { break }\n    if !strings.Contains(err.Error(), \"Could not retrieve\") { break } // only retry transport errors\n    time.Sleep(time.Duration(i+1) * time.Second)\n}","preventionTips":["Configure 'nvm proxy' on corporate networks.","Keep NVM_NODE_MIRROR/NVM_NPM_MIRROR pointed at reachable mirrors.","Test the mirror with curl before blaming nvm."],"tags":["network","http","dns","proxy","mirror"],"backgroundTag":null,"analyzedSha":"5b18223ca19ff50d707f35410dbc6bd440a9f74d","analyzedAt":"2026-08-15T10:06:51.428Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}