[Bug] Remote Control: Cannot read properties of undefined (reading 'session_url') on orphaned sessions
Bug Description
Remote Control (Claude Desktop, Windows): disable toggle throws "Cannot read properties of undefined (reading 'session_url')" on orphaned sessions; sessions get orphaned by 401 auth churn and by code-4090 active-worker supersession.
ENV: Claude Desktop 1.22209.0.0 (WindowsApps x64); bundled Claude Code CLI 2.1.209; Windows 11 Pro 26200. Setup: remote control enabled on the DESKTOP for several sessions in parallel, driven from the PHONE app. Parallel multi-session normally works fine.
Setup: remote control enabled on the DESKTOP for several sessions in parallel, driven from the PHONE app. Parallel multi-session normally works fine.
SUMMARY: Two server/auth-side events leaobject gone, UI card still shown). Onceorphaned, tapping the disable toggle throws a TypeError and never turns off — the handler reads session_url off an undefined session. Re-tapping reproduces it. Only recovery is a full app restart, which disconnects ALL sessions.
TRIGGER 1 — code 4090 "no longer the active worker for the session": spontaneous, server-side, while the desktop was IDLE (no local action). Dropped all-but-the-most-recent of several parallel sessions. 2026-07-20 03:39:36–03:41:03.
TRIGGER 2 — 401 auth churn: frequent "[oauth] CLI requested token refresh after 401" (72x on 2026-07-19).
Orphans the session mid-flight during th
REPRO:
1. On desktop, enable remote control on ive from phone app.
2. Hit either trigger (spontaneous 4090 drop, or a 401 during use).
3. Tap the remote-control toggle to DISABLE on an affected session.
4. ACTUAL: "Failed to toggle remote control … Cannot read properties of undefined (reading 'session_url')"; toggle never flips off; re-tapping repeats.
5. EXPECTED: disabling an already-gone session succeeds (flip UI to off, no throw).
LOG EVIDENCE (Desktop main.log; ids shortened):
03:39:36 [remote-control] bridge_state: failed — Transport closed: this connection is no longer the active
worker for the session (code 4090) [rep0:48, 03:41:03]
04:16:40 Disabling remote control for session cf68559a…
04:16:43 [oauth] CLI requested token refresh after 401
04:16:44 [error] Failed to toggle remonot read properties of undefined (reading'session_url')
… same 3-step pattern for 24354656, 6517fb21, b24f35ef, 93098c43, d56ce617 through 04:17:11 (6 sessions, ~7s apart)
SUGGESTED FIXES:
1. Null-check the disable/toggle handler — if the session lookup is undefined, treat as already-disconnected (flip card to off, return, no throw). Primary bug.
2. Recover/clear orphaned sessions after a 4090 or 401 instead of leaving zombie cards clearable only by full restart.
3. Investigate the spurious code-4090 active-worker supersession hitting idle parallel sessions (dropped all-but-one with no client action).
4. Reduce the 401 refresh churn from the bundled CLI (2.1.209).
IMPACT: cannot cleanly disable remote coorkarounds are the ~900s idle timeout,closing the individual session, or an app restart (disconnects everything).
Environment Info
- Platform: win32
- Terminal: xterm-256color
- Version: 2.1.214
- Feedback ID: 3fbb17e1-7996-4c28-ba7f-7d87bb7af3a7
Errors
[]This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗