BridgeFatalError: Environment not found crashes CLI during idle remote-control sessions

Resolved 💬 4 comments Opened Mar 10, 2026 by matclothier Closed Apr 8, 2026

Bug description

When using Claude Code in remote-control mode (launched with --remote-control), the CLI crashes with a BridgeFatalError after the session has been idle for an extended period (20–45 minutes). The environment appears to be garbage-collected server-side while the bridge is still polling for work, causing an unrecoverable fatal error.

Reproduction steps

  1. Launch Claude Code with --remote-control and --debug-file
  2. Start a conversation and reach a point where user input is required (e.g., AskUserQuestion or ExitPlanMode pending approval)
  3. Leave the session idle for 20–45 minutes
  4. The CLI crashes with BridgeFatalError: Environment <env_id> not found

Error details

From debug logs:

2026-03-01T22:03:47.222Z [ERROR] BridgeFatalError: BridgeFatalError: Environment env_018Tg6D3ZteUpzb7mxbpEPhv not found.
    at VAT (/$bunfs/root/claude:6285:11444)
    at pollForWork (/$bunfs/root/claude:6285:8347)
    at async R$0 (/$bunfs/root/claude:6318:804)
2026-03-03T18:13:36.204Z [ERROR] BridgeFatalError: BridgeFatalError: Environment env_01UdNMGj2TgSSKdiomgxyWPu not found.
    at VAT (/$bunfs/root/claude:6285:11444)
    at pollForWork (/$bunfs/root/claude:6285:8347)
    at async R$0 (/$bunfs/root/claude:6318:804)

In both cases, the last activity before the crash was a pending tool approval (the bridge was waiting for user interaction). The poll loop continued with empty responses until the environment was removed.

Expected behavior

The CLI should either:

  • Send keepalive/heartbeat to prevent environment GC during active sessions
  • Gracefully handle environment expiry (reconnect or inform user) instead of crashing with a fatal error

Environment

  • OS: macOS (Darwin 25.3.0, Apple Silicon)
  • Claude Code: latest (installed via brew)
  • Mode: --remote-control with --debug-file

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗