[BUG] OAuth login fails with ERR_INVALID_IP_ADDRESS behind corporate proxy (regression since 2.0.37)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Environment
- Claude Code Version: 2.0.53
- Operating System: RHEL-based container (Dataiku Code Studio)
- Terminal: bash
- Platform: Anthropic API
- Node.js: 18.x
- Network: Corporate proxy (HTTP/HTTPS)
Bug Description
OAuth login fails with ERR_INVALID_IP_ADDRESS when running Claude Code behind a corporate proxy. The error occurs immediately when running claude or /login.
Error message:
Unable to connect to Anthropic services
Failed to connect to api.anthropic.com: ERR_INVALID_IP_ADDRESS
Key Finding: API Works, OAuth Doesn't
The network path to Anthropic is fully functional:
$ curl -v https://api.anthropic.com 2>&1 | head -20
* Uses proxy env variable https_proxy == 'http://b2b-http.dhl.com:8080'
* Connected to b2b-http.dhl.com (10.28.254.17) port 8080
* Proxy replied 200 to CONNECT request
# ... TLS handshake succeeds
API key authentication works:
$ export ANTHROPIC_API_KEY="sk-ant-..."
$ claude --print "hello"
Credit balance is too low # ← Connection succeeded, just no credits
Only OAuth login fails with the IP address error.
Attempted Workarounds (None Worked)
| Attempt | Result |
|---------|--------|
| export NODE_OPTIONS="--dns-result-order=ipv4first" | No effect |
| export CLAUDE_CODE_OAUTH_TOKEN=<token from setup-token> | Still prompts for login |
| export ANTHROPIC_AUTH_TOKEN=<token> | No effect |
| Disable IPv6 via sysctl | Permission denied in container |
Working Workaround
Downgrading to v2.0.37 fixes the issue. A colleague using 2.0.37 behind the same proxy can login successfully.
npm install -g @anthropic-ai/claude-code@2.0.37
claude /login # Works
Regression
- 2.0.37: ✅ Works behind corporate proxy
- 2.0.53: ❌ Fails with ERR_INVALID_IP_ADDRESS
Exact version where regression occurred is unknown (not tested: 2.0.38–2.0.52).
Expected Behavior
OAuth login should work behind corporate proxies when:
HTTPS_PROXYis correctly setcurlcan reachapi.anthropic.comthrough the proxy- API key authentication works
Related Issues
- #12081 -
/login leads to invalid IP Address - #12040 -
OAuth authentication is currently not supported - #11464 -
OAuth authentication fails in proxy environment - #332 -
Claude Code unable to connect through corporate proxy in WSL
Additional Context
This appears to be a regression in how the OAuth flow handles DNS resolution or proxy tunneling. The underlying API connectivity is fine — only the OAuth code path is affected.
What Should Happen?
Claude Code VSCode extension should authenticate the session successfully.
Error Messages/Logs
Steps to Reproduce
Steps to Reproduce
- Run Claude Code in a containerized environment behind a corporate HTTP proxy
- Set
HTTPS_PROXY=http://your-proxy:port - Run
claudeorclaude /login - Observe
ERR_INVALID_IP_ADDRESSerror
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.0.37
Claude Code Version
2.0.53
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 12 comments on GitHub. Read the full discussion on GitHub ↗