[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

  1. 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.
  2. Install Claude Code (any recent version)
  3. rm ~/.claude/.credentials.json to clear existing auth
  4. tcpdump 'host api.anthropic.com'
  5. run ``claude`` from terminal
  6. /login — browser completes, terminal errors with OAuth error: The socket connection was closed unexpectedly
  7. tcdump during Claude Code failure shows only QUIC (UDP 443) traffic — zero TCP SYN packets attempted
  8. curl https://api.anthropic.com succeeds (TCP HTTPS)
  9. Add rule: ``echo "block out proto udp from any to 160.79.104.0/24 port 443" | sudo tee /etc/pf.anchors/blockquic``
  10. `` sudo pfctl -a blockquic -f /etc/pf.anchors/blockquic``
  11. `` sudo pfctl -e``
  12. run ``claude`` from terminal
  13. /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_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗