[BUG] OAuth error: The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch()
Resolved 💬 1 comment Opened Apr 17, 2026 by atmclarke Closed May 26, 2026
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 on networks with broken QUIC/UDP path — no TCP fallback.
Claude Code fails to connect to api.anthropic.com (and other backend services) on networks where UDP port 443 / QUIC traffic is dropped or broken, even though TCP HTTPS to the same endpoints works fine. The underlying Bun runtime appears to prefer QUIC/HTTP/3 and does not fall back to TCP HTTPS when QUIC fails, unlike curl and mainstream browsers which implement fallback behaviour.
What Should Happen?
It should login.
Error Messages/Logs
OAuth error: The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch()
Steps to Reproduce
- Reproducible on specific networks where QUIC/UDP 443 is mangled in ways TCP HTTPS is not. I don't have a clean way to reproduce this on arbitrary hardware, and I suspect it'll be inconsistent across installs depending on firmware, MTU, and CGNAT state.
- Install Claude Code (any recent version)
- rm ~/.claude/.credentials.json to clear existing auth
- tcpdump 'host api.anthropic.com'
- run ``
claude`` from terminal - /login — browser completes, terminal errors with OAuth error: The socket connection was closed unexpectedly
- tcdump during Claude Code failure shows only QUIC (UDP 443) traffic — zero TCP SYN packets attempted
- curl https://api.anthropic.com succeeds (TCP HTTPS)
- Add rule: ``
echo "block out proto udp from any to 160.79.104.0/24 port 443" | sudo tee /etc/pf.anchors/blockquic`` - ``
sudo pfctl -a blockquic -f /etc/pf.anchors/blockquic`` - ``
sudo pfctl -e`` - run ``
claude`` from terminal - /login now works.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.112
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗