Remote Control (server mode): 'failed to disconnect' — TypeError reading 'session_url'
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-clisessions (fleet); UUIDs redacted.
What happened
- Remote Control server running in server mode, hosting several sessions.
- From the Claude mobile app, a disconnect action was triggered on a session.
- 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/statusto 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
- Fix the
session_urlnull-deref on the disconnect path. - Document (or add) safe single-session recovery in server mode.
- Confirm child-session lifecycle when the server restarts (killed vs reparented).
3 Comments
same thing.
Same error on a very different setup, which may help narrow it down — this is not limited to server mode.
Environment
--spawn, no fleet, no server mode/remote-controlin the appObserved
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 derefsession_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
~/.claudeforsession_url/remoteControl/remote_controlacross*.jsonand*.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.
Claude Code app version Claude 1.24012.9 (03c61d) 2026-07-24T04:59:17.000Z
Same error with /remote-control almost every time.