coreybutler/nvm-windows · warning

error: reading response body: %v

Error message

error: reading response body: %v

What it means

checkForUpdate fetches the latest-release JSON from the update URL and this error wraps any failure of that fetch. Despite the wording 'reading response body', the wrapped %v is the whole get() error — it can be a transport error (offline, DNS, TLS) or the non-200 status from error 48. The function still returns a usable (empty) Update struct alongside the error.

Source

Thrown at src/upgrade/upgrade.go:742

	}
	defer resp.Body.Close()

	if resp.StatusCode != http.StatusOK {
		return []byte{}, fmt.Errorf("error: received status code %d", resp.StatusCode)
	}

	return io.ReadAll(resp.Body)
}

func checkForUpdate(url string) (*Update, error) {
	u := Update{Assets: []string{}, Warnings: []string{}, VersionWarnings: []string{}}
	r := Release{}

	// Make the HTTP GET request
	utility.DebugLogf("checking for updates at %s", url)
	body, err := get(url, false)
	if err != nil {
		return &u, fmt.Errorf("error: reading response body: %v", err)
	}

	// Parse JSON into the struct
	utility.DebugLogf("Received:\n%s", string(body))
	err = json.Unmarshal(body, &r)
	if err != nil {
		return &u, fmt.Errorf("error: parsing release: %v", err)
	}

	u.Version = r.Version
	utility.DebugLogf("latest version: %s", u.Version)

	// Comment the next line when development is complete
	// u.Version = "2.0.0"
	for _, asset := range r.Assets {
		if value, exists := asset["name"]; exists && value.(string) == "update.exe" {
			u.Assets = append(u.Assets, value.(string))
		}

View on GitHub (pinned to 5b18223ca1)

Solutions

  1. Confirm you can fetch the update-check URL directly (curl -L) from the same machine.
  2. Address the underlying get() failure: proxy env vars, rate limit (wait), or TLS trust.
  3. Set NVM_DISABLE_UPDATE_CHECK or equivalent offline behavior (per version docs) if the machine is intentionally offline.
  4. Retry — the check runs on every command, so transient failures self-heal.
Defensive patterns

Strategy: fallback

Validate before calling

// Wrap the update check so it degrades gracefully
if _, err := checkForUpdate(url); err != nil {
    utility.DebugLogf("update check skipped: %v", err) // proceed without update info
}

Try / catch

The update check is auxiliary: catch, log at debug level, and continue normal nvm operation. Never let a failed check block node installs/uninstalls.

Prevention

When it happens

Trigger: Any 'nvm' invocation that triggers an update check while offline or behind a blocking proxy; update-check URL returning 403/429 (GitHub rate limit) so get() fails; DNS resolution failure for the update host; TLS interception with an untrusted root.

Common situations: Air-gapped or heavily proxied machines; GitHub API rate limits on shared CI egress IPs; flaky Wi-Fi at the moment the background update check fires; misconfigured mirror URL for the update feed.

Related errors


AI-assisted analysis of coreybutler/nvm-windows@5b18223ca1 (2026-08-15). Data as JSON: /api/errors/9a6967bc1b94cde6. Report an issue: GitHub.