[BUG] Backgrounded/reconnected sessions do not use the configured proxy and fail to connect (ConnectionRefused)

Status Open
Reported on v2.1.212
Maintainer reply None cached
Activity 1 comment · opened Jul 17, 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?

In an environment where a web proxy is configured via http_proxy/https_proxy environment variables at the user/system level.

After a session is backgrounded or reconnected to, all requests stop working with a ConnectionRefused error:

API Error: Unable to connect to API (ConnectionRefused)

Looks like once a session has been backgrounded, it starts running under a different process context. Examining this process in Process Explorer shows that while it inherits most of the user's environment variables, http_proxy and https_proxy are missing. From this point forward, it is impossible to do anything meaningful in this session since all requests fail with connection errors.

Meanwhile, new sessions from new invocations of claude connect without issue, at least until they are backgrounded or reconnected to at which point they fail similarly.

What Should Happen?

Claude should connect via the inherited http_proxy or https_proxy proxy when in background sessions.

Error Messages/Logs

API Error: Unable to connect to API (ConnectionRefused)

Steps to Reproduce

  1. Be on a Windows system that blocks internet access except through a HTTP proxy
  2. Configure http_proxy and https_proxy environment variable at the user/system level (not in Claude settings)
  3. Launch claude cli
  4. Send a test message
  5. /background
  6. Re-open the session via claude agents or claude attach
  7. Send a test message
  8. API connection errors occur

Claude Model

Other

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.212

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

_No response_

View original on GitHub ↗

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