Remote Control (server mode): 'failed to disconnect' — TypeError reading 'session_url'

Status Open
Reported on v2.1.218
Maintainer reply None cached
Activity 3 comments · opened Jul 25, 2026

Bug report: Remote Control "failed to disconnect" — Cannot read properties of undefined (reading 'session_url')

Summary

In Remote Control server mode, a disconnect action initiated from the mobile app fails with a client-side TypeError:

Remote Control failed to disconnect: Cannot read properties of undefined (reading 'session_url')

The disconnect does not complete. The hosted session remains alive and usable (verified — see below), so the error is cosmetic but alarming: it surfaces as a red failure with no clean recovery and no documented remediation.

Environment

  • Claude Code: 2.1.218 (native build); embedded remote CLI ccd-cli 2.1.219
  • Platform: Linux (headless droplet), first-party auth (api.anthropic.com), Max plan
  • Mode: Remote Control server

claude remote-control --name "<name>" --spawn=same-dir --capacity=8 --permission-mode bypassPermissions

  • Server hosts multiple concurrent child ccd-cli sessions (fleet); UUIDs redacted.

What happened

  1. Remote Control server running in server mode, hosting several sessions.
  2. From the Claude mobile app, a disconnect action was triggered on a session.
  3. Client threw Cannot read properties of undefined (reading 'session_url') and reported "failed to disconnect."

Server-side evidence

remote-server.log shows the RPC socket tearing down at the same moment a client detached:

14:31:53 [frameSink] write failed, detaching: write unix .../rpc.sock->@: write: broken pipe
14:31:53 [Server] writeResponse: wrote 0/69 bytes, error=... broken pipe
14:31:53 [Server] Failed to write response: ... broken pipe
14:31:53 [Server] scanner error on @: read unix .../rpc.sock->@: read: connection reset by peer

Reads as: client disconnected abruptly; the disconnect handler dereferenced session_url on an object that was already undefined (session metadata lost during the socket teardown) → TypeError.

Impact

  • Cosmetic but there is no clean recovery path. Docs don't cover: whether the session is wedged, how to reconnect after a failed disconnect, or how to stop one session without killing the whole server.
  • In server mode there is no claude remote-control list/stop/status to manage a single hosted session, so the only "reset" is restarting the whole server — which drops every hosted session. Bad for a multi-session fleet.

Confirmed: session survives

After the error, /context sent to the same session responded normally. So the session was never actually disconnected — the failure is purely in the disconnect path.

Expected

  • Disconnect should null-check session_url (or the session object) and either complete or fail gracefully with a real recovery hint.
  • Server mode should expose per-session lifecycle (list / stop / status) so one session can be cleared without dropping the server.

Requests

  1. Fix the session_url null-deref on the disconnect path.
  2. Document (or add) safe single-session recovery in server mode.
  3. Confirm child-session lifecycle when the server restarts (killed vs reparented).

View original on GitHub ↗

3 Comments

skowalski-mod · 1 month ago

same thing.

kenliao168 · 1 month ago

Same error on a very different setup, which may help narrow it down — this is not limited to server mode.

Environment

  • Claude Code desktop app on Windows 11 Pro (10.0.26200) — no --spawn, no fleet, no server mode
  • Single long-running session in a project directory, several MCP servers connected
  • Triggered simply by entering /remote-control in the app

Observed
Remote Control failed to disconnect: Cannot read properties of undefined (reading 'session_url') appears immediately on invoking /remote-control, i.e. on the first invocation — before any session has been established or any disconnect requested. So the teardown path seems to run (and deref session_url) even when there is no prior session object.

Reproduces every time. Fully quitting and reopening the desktop app does not clear it.

Ruled out: stale local state
Searched ~/.claude for session_url / remoteControl / remote_control across *.json and *.jsonl (excluding conversation transcripts) — no matches. So there is no local state file a user can delete as a workaround, which matches your point about there being no documented recovery path.

Given #78938 mentions the same TypeError "after code 4090 takeover", a plausible common cause is server-side session state outliving the client, with the disconnect handler assuming the session object exists.

Also seconding the request for per-session lifecycle commands — on the desktop app there is likewise no way to inspect or clear a single remote-control session.

marcvig · 1 month ago

Claude Code app version Claude 1.24012.9 (03c61d) 2026-07-24T04:59:17.000Z

Same error with /remote-control almost every time.