[BUG] Drop HTTP connection on "access denied" API errors

Status Open
Reported on v2.1.287
Maintainer reply None cached
Activity 0 comments · opened Oct 6, 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?

When getting Access Denied from the API server e.g. Vertex AI, it could be due to an IP restriction which can be corrected with a VPN connection.

Even once a VPN connection is established, Claude is wedged in a state where it keeps getting "Access Denied" since it keeps reusing the pre-VPN socket that connects over the non-VPN interface.

What Should Happen?

Drop HTTP keep-alive socket on auth errors.

Error Messages/Logs

Steps to Reproduce

  1. Set up an API server with IP allowlist.
  2. Start Claude while the "VPN" interface that uses allowlisted IP is down.
  3. Observe Claude getting an auth error.
  4. Bring up the "VPN" interface.
  5. Observe Claude is still getting an auth error.
  6. Restart Claude.
  7. Observe Claude manages to auth.

Claude Model

_No response_

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.287

Platform

Google Vertex AI

Operating System

Ubuntu/Debian Linux

Terminal/Shell

iTerm2

Additional Information

_No response_

View original on GitHub ↗