[BUG] Crash when `http(s)_proxy` environment vaiable points to a socks proxy

Resolved 💬 4 comments Opened Jul 12, 2025 by rijenkii Closed Dec 10, 2025

Environment

  • Platform (select one):
  • [ ] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [x] Other: N/A
  • Claude CLI version: 1.0.51 (Claude Code)
  • Operating System: Fedora 42
  • Terminal: ptyxis

Bug Description

Starting claude code with environment variables http_proxy or https_proxy set to a url of a socks5 proxy crashes the application.

Steps to Reproduce

  1. Run the following commands:

``bash
export http_proxy="socks5h://127.0.0.1:1080"
export https_proxy="socks5h://127.0.0.1:1080"
npx --package @anthropic-ai/claude-code claude --version
``

Expected Behavior

Application to at least start.

Actual Behavior

file:///home/rijenkii/.npm/_npx/becf7b9e49303068/node_modules/@anthropic-ai/claude-code/cli.js:236
(line removed because it was too long)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

OW0 [InvalidArgumentError]: Invalid URL protocol: the URL must start with `http:` or `https:`.
    at eW0 (file:///home/rijenkii/.npm/_npx/becf7b9e49303068/node_modules/@anthropic-ai/claude-code/cli.js:236:13601)
    at Object.Il9 [as parseOrigin] (file:///home/rijenkii/.npm/_npx/becf7b9e49303068/node_modules/@anthropic-ai/claude-code/cli.js:236:13708)
    at new QV0 (file:///home/rijenkii/.npm/_npx/becf7b9e49303068/node_modules/@anthropic-ai/claude-code/cli.js:274:8131)
    at Eo9 (file:///home/rijenkii/.npm/_npx/becf7b9e49303068/node_modules/@anthropic-ai/claude-code/cli.js:274:13478)
    at new qV0 (file:///home/rijenkii/.npm/_npx/becf7b9e49303068/node_modules/@anthropic-ai/claude-code/cli.js:274:14475)
    at file:///home/rijenkii/.npm/_npx/becf7b9e49303068/node_modules/@anthropic-ai/claude-code/cli.js:624:20574
    at Q (file:///home/rijenkii/.npm/_npx/becf7b9e49303068/node_modules/@anthropic-ai/claude-code/cli.js:526:14406)
    at gU0 (file:///home/rijenkii/.npm/_npx/becf7b9e49303068/node_modules/@anthropic-ai/claude-code/cli.js:624:20953)
    at file:///home/rijenkii/.npm/_npx/becf7b9e49303068/node_modules/@anthropic-ai/claude-code/cli.js:742:1176
    at Q (file:///home/rijenkii/.npm/_npx/becf7b9e49303068/node_modules/@anthropic-ai/claude-code/cli.js:526:14406) {
  code: 'UND_ERR_INVALID_ARG'
}

Node.js v22.15.0

Additional Context

<!-- Add any other context about the problem here, such as screenshots, logs, etc. -->

View original on GitHub ↗

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