[BUG] HTTP_PROXY fails when using nvm

Resolved 💬 3 comments Opened Sep 2, 2025 by josephwhenry Closed Jan 7, 2026

Environment

  • Platform (select one):
  • [X] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • Claude CLI version: 1.0.100 (Claude Code)
  • Operating System: MacOS Sonoma 14.7.1 (Apple Silicon)
  • Also replicated in Debian 12.11 (Bookworm)
  • Terminal: iTerm2 3.5.14
  • Also replicated in QTerminal v2.1.0

Bug Description

Claude fails to connect to Anthropic's API when HTTP_PROXY or HTTPS_PROXY are set, but only when using a node version installed through nvm.

Steps to Reproduce

  1. Install nvm: https://github.com/nvm-sh/nvm?tab=readme-ov-file#installing-and-updating
  2. Use the system node: nvm use system
  3. Verify the node version: node --version // v24.6.0 in my case
  4. Install claude code: npm install -g @anthropic-ai/claude-code
  5. Set HTTP proxies: export HTTP_PROXY=http://localhost:8080 && export HTTPS_PROXY=http://localhost:8080
  6. Observe that HTTP proxying works fine:
$ claude
╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code!                         │
│                                                   │
│   /help for help, /status for your current setup  │
│                                                   │
│   cwd: <redacted>                                 │
╰───────────────────────────────────────────────────╯

> This is a test. Say hello.

⏺ Hello!
  1. (optional) Confirm in your proxy logs that the requests came through
  2. Install some other version of node through nvm: nvm install v24.6.0
  • Note: This is the exact same NodeJS version as my system has
  1. Use the installed version: nvm use v24.6.0
  2. Re-set the proxy variables: export HTTP_PROXY=http://localhost:8080 && export HTTPS_PROXY=http://localhost:8080
  3. Observe that API requests now fail:
$ claude
╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code!                         │
│                                                   │
│   /help for help, /status for your current setup  │
│                                                   │
│   cwd: <redacted>                                 │
╰───────────────────────────────────────────────────╯

> This is a test. Say hello
  ⎿  API Error (Connection error.) · Retrying in 5 seconds… (attempt 4/10)
    ⎿  TypeError (fetch failed)

Unfortunately, my proxy logs are not sophisticated enough to diagnose a root cause here.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗