[BUG] Claude Code fails with ESERVFAIL on HPC systems with DNS infrastructure issues
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?
Summary
Claude Code CLI fails to authenticate and install on HPC systems when the primary DNS nameserver returns ESERVFAIL errors, even though secondary DNS servers can resolve the domains successfully. The CLI does not gracefully fall back to secondary DNS servers.
Environment
Claude Code Version: 2.1.191, 2.1.196
Platform: Linux (HPC cluster - Ubuntu-based)
OS: Linux
Node Examples: hpc-wfly-a002, hpc-enri-i006
Network: Behind institutional firewall with multiple DNS servers
Issue Description
When attempting to use Claude Code on an HPC system with DNS infrastructure issues, the CLI fails with ESERVFAIL errors even though:
Secondary DNS servers work fine
Other tools (curl, wget, nslookup) can resolve Anthropic domains
The connection to Anthropic's servers is not blocked
During installation:
Failed to fetch version from https://downloads.claude.ai/claude-code-releases/latest after 3 attempt(s): getaddrinfo ESERVFAIL downloads.claude.ai
Diagnostic Output
bash$ nslookup api.anthropic.com
;; Got SERVFAIL reply from 192.168.222.253, trying next server
Server: 155.69.3.8
Address: 155.69.3.8#53
Non-authoritative answer:
Name: api.anthropic.com
Address: 160.79.104.10
;; Got SERVFAIL reply from 192.168.222.253, trying next server
Note: DNS resolution succeeds via secondary server, but Claude Code still fails.
bash$ curl -I https://api.anthropic.com
HTTP/2 404 # Connection works, but returns 404 (likely auth failure)
Additional Context
This issue affects institutional HPC systems where DNS infrastructure has multiple nameservers. Claude Code fails when the primary nameserver fails, even though secondary nameservers work fine. Other standard tools handle this gracefully.
What Should Happen?
Expected Behavior
Claude Code should work when secondary DNS servers are available and functional, even if the primary DNS server fails. Standard tools like curl and wget handle this automatically.
Actual Behavior
Claude Code fails with ESERVFAIL and exits immediately, even though DNS resolution succeeds via secondary servers.
Error Messages/Logs
Error Messages
Unable to connect to Anthropic services
Failed to connect to api.anthropic.com: ESERVFAIL
Steps to Reproduce
On an HPC system with a primary DNS server that fails for specific domains
Run claude or curl -fsSL https://claude.ai/install.sh | bash
Observe ESERVFAIL errors for api.anthropic.com and downloads.claude.ai
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.196
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗