[BUG] Remote Control "disconnect" always fails with "Cannot read properties of undefined (reading 'session_url')" (toggle-off path missing null guard)

Open 💬 2 comments Opened Jul 15, 2026 by lile-cs

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?

Turning Remote Control OFF fails 100% of the time. Enabling works and mints a
session URL; disabling immediately throws "Cannot read properties of undefined
(reading 'session_url')" and surfaces "Remote Control failed to disconnect: ..."
in the chat. The disconnect does not complete cleanly (no bridge teardown), so the
remote bridge appears to stay live until the app is restarted.

What Should Happen?

Toggling off disconnects the remote bridge cleanly and shows "Remote Control
session ended."

Error Messages/Logs

Logs (main.log) - enable OK, every disable fails identically:
  [info] Enabling remote control for session local_...
  [info] [remote-control] bridge_state: ready
  [info] Remote control enabled: https://claude.ai/code/session_01UDi5ZDmwtRNTgf6PrapUTY
  [info] [remote-control] bridge_state: connected
  ...
  [info] Disabling remote control for session local_...
  [error] Failed to toggle remote control for local_...: Cannot read properties of
          undefined (reading 'session_url')
(4/4 disable attempts across the session failed with this exact error; 0 failures
on enable.)

Steps to Reproduce

  1. Open a local Code session, send a message so a session is active.
  2. Toggle Remote Control ON (/remote-control). Observe it connects and a

https://claude.ai/code/session_... URL is produced.

  1. Toggle Remote Control OFF (/remote-control again).
  2. Observe the error toast/message: "Remote Control failed to disconnect: Cannot

read properties of undefined (reading 'session_url')".
Reproduces every time on step 3.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

1.21459.0.0

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

Root cause (confirmed by reading the shipped bundle)
File: app.asar -> .vite/build/index.chunk-DYOjx3aH.js (session-manager remote-control
toggle). API client: index.chunk-5mFusjzq.js (enableRemoteControl).
The toggle method calls enableRemoteControl(enabled) for both directions, then reads
session_url off the result without guarding the result itself:
const a = await e.query.enableRemoteControl(i, i ? e.title : void 0),
c = (n = a.session_url) == null ? void 0 : n.split("/").filter(Boolean).pop();
enableRemoteControl returns .response of the request:
async enableRemoteControl(t, r) {
return (await this.request({ subtype: "remote_control", enabled: t,
...(r !== void 0 && { name: r }) })).response
}
On disable (enabled=false) the reply has no .response payload, so a is undefined
and a.session_url throws. The existing check (n = a.session_url) == null ? ...
guards the property value, not the object a - one level too shallow. Enable only
works because its reply is a populated { session_url, ... } object. The throw is
caught and, because it's the disable branch, re-surfaced as
Remote Control failed to disconnect: ${message}.

View original on GitHub ↗

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