[BUG] Claude Code (Bun runtime) fails with getaddrinfo ETIMEOUT when /etc/resolv.conf has trailing inline comments on nameserver lines
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?
Claude Code fails to authenticate with:
Login failed: getaddrinfo ETIMEOUT platform.claude.com
This is reproducible identically via claude auth login from a plain terminal (no VS Code involved), so the issue is isolated to Claude Code's own runtime, not the extension or VS Code integration.
At the same time, on the identical machine and network:
curl -4andcurl -6tohttps://platform.claude.comboth succeed instantlynslookup/digagainst all 3 configured nameservers succeed in <50ms each
This points to Claude Code's bundled Bun runtime (confirmed via /$bunfs/root/src/entrypoints/cli.js appearing in error stack traces) using its own DNS resolver rather than glibc's getaddrinfo, and that resolver behaving differently from every standard system tool.
Root Cause Identified
The cluster's /etc/resolv.conf, managed by Quattor, contains trailing inline comments on each nameserver line:
Generated by NetworkManager
search example.edu
nameserver 10.0.0.1 # added by Quattor
nameserver 10.0.0.2 # added by Quattor
nameserver 203.0.100.3 # added by Quattor
Confirmed fix: removing the trailing # added by Quattor comments from each nameserver line (moving them to their own separate comment lines, or removing them entirely) immediately resolved the issue — Claude Code login succeeded right after.
The cluster's config management system (Quattor) will regenerate resolv.conf with these comments on future updates, so this fix is temporary and the bug will recur. This is not something that can be permanently fixed on the client/cluster side without an ongoing manual workaround.
What Should Happen?
Claude Code's DNS resolution should tolerate trailing comments in /etc/resolv.conf, consistent with resolv.conf(5) parsing behavior in glibc and virtually every other standard tool (curl, nslookup, dig, Node.js's dns.lookup()).
Error Messages/Logs
Steps to Reproduce
- On a Linux host with
/etc/resolv.confcontaining trailing inline comments afternameserverdirectives (e.g.nameserver 1.2.3.4 # some comment) - Run
claude auth login - Observe
getaddrinfo ETIMEOUTon the OAuth callback domain, despitecurl/nslookup/digall succeeding against the same domain and nameservers
Environment
- OS (remote, running Claude Code): Linux (HPC cluster, Quattor-managed configuration)
- Connection: SSH (VS Code Remote-SSH)
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.212
Platform
Other
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
Related Issues
This may be related to
- https://github.com/anthropics/claude-code/issues/72706
- https://github.com/anthropics/claude-code/issues/71824
which reports the same underlying symptom ("Claude Code's bundled DNS resolver fails on Anthropic domains, but the
system resolver (used by curl) works") without a confirmed root cause.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗