claude-code - 💡(How to fix) Fix Remote Control sessions show "Remote Control disconnected" banner on first turn despite session succeeding (control_response error="Already initialized") [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54838Fetched 2026-04-30 06:34:31
View on GitHub
Comments
2
Participants
3
Timeline
6
Reactions
0
Timeline (top)
labeled ×4commented ×2

Error Message

Root cause (from bridge logs): The desktop app sends a control_request {subtype: "initialize"} immediately after spawn, but the SDK child has already auto-initialized because it was launched with --print --input-format=stream-json --output-format=stream-json. The SDK responds with control_response {subtype: "error", error: "Already initialized"}. The app treats that error as a fatal disconnect and surfaces the banner, even though the session is fully functional. (c) The app should not interpret control_response {error: "Already initialized"} as a fatal disconnect — it should recognize the session is alive and suppress the banner.

Error Messages/Logs

[bridge:ws] sessionId=cse_… <<< {"type":"control_response","response":{"subtype":"error","error":"Already initialized","request_id":"…",…}} 3. SDK returns control_response {subtype: "error", error: "Already initialized"} — because stream-json mode auto-initializes

Root Cause

Root cause (from bridge logs): The desktop app sends a control_request {subtype: "initialize"} immediately after spawn, but the SDK child has already auto-initialized because it was launched with --print --input-format=stream-json --output-format=stream-json. The SDK responds with control_response {subtype: "error", error: "Already initialized"}. The app treats that error as a fatal disconnect and surfaces the banner, even though the session is fully functional.

Code Example

[bridge:ws] sessionId=cse_… <<< {"client_platform":"desktop_app","message":{"content":"hello hello",},"type":"user",}
[bridge:ws] sessionId=cse_… <<< {"request":{"subtype":"initialize"},"request_id":"…","type":"control_request",}
[bridge:ws] sessionId=cse_… <<< {"type":"control_response","response":{"subtype":"error","error":"Already initialized","request_id":"…",}}
[bridge:ws] sessionId=cse_… <<< {"type":"system","subtype":"init",}
[bridge:ws] sessionId=cse_… <<< {"type":"assistant","message":{}}
[bridge:ws] sessionId=cse_… <<< {"type":"result","subtype":"success","is_error":false,"terminal_reason":"completed",}
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

On every fresh Remote Control session, the desktop app and web client briefly show a red "Remote Control disconnected — Your terminal's Claude Code session stopped responding" banner immediately after sending the first message. The assistant response arrives ~2 seconds later and renders normally. The banner persists; the session continues to work.

Root cause (from bridge logs): The desktop app sends a control_request {subtype: "initialize"} immediately after spawn, but the SDK child has already auto-initialized because it was launched with --print --input-format=stream-json --output-format=stream-json. The SDK responds with control_response {subtype: "error", error: "Already initialized"}. The app treats that error as a fatal disconnect and surfaces the banner, even though the session is fully functional.

What Should Happen?

At least one of the following:

(a) The app should not send initialize to a stream-json session that auto-initializes on launch, or (b) The SDK should treat a duplicate initialize as a no-op success (idempotent), or (c) The app should not interpret control_response {error: "Already initialized"} as a fatal disconnect — it should recognize the session is alive and suppress the banner.

Error Messages/Logs

[bridge:ws] sessionId=cse_… <<< {"client_platform":"desktop_app","message":{"content":"hello hello",…},"type":"user",…}
[bridge:ws] sessionId=cse_… <<< {"request":{"subtype":"initialize"},"request_id":"…","type":"control_request",…}
[bridge:ws] sessionId=cse_… <<< {"type":"control_response","response":{"subtype":"error","error":"Already initialized","request_id":"…",…}}
[bridge:ws] sessionId=cse_… <<< {"type":"system","subtype":"init",…}
[bridge:ws] sessionId=cse_… <<< {"type":"assistant","message":{}}
[bridge:ws] sessionId=cse_… <<< {"type":"result","subtype":"success","is_error":false,"terminal_reason":"completed",…}

Steps to Reproduce

  1. Run claude remote-control (any spawn mode — systemd user service or interactive)
  2. Connect from the desktop app or claude.ai/code web client
  3. Send any message on the first turn
  4. Observe the red "Remote Control disconnected" banner appears immediately, while the assistant response also arrives ~2 seconds later and renders normally

The banner appears on every session, not intermittently.

Claude Model

None

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.123 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

Environment: Debian 12 on Proxmox, headless SSH-only server. claude remote-control runs as a systemd --user service. Terminal: bash over SSH (no GUI).

Diagnosis: The sequence in every bridge log is:

  1. App sends user message
  2. App immediately sends control_request {subtype: "initialize"}
  3. SDK returns control_response {subtype: "error", error: "Already initialized"} — because stream-json mode auto-initializes
  4. App interprets this as a disconnect and shows the banner
  5. Session proceeds normally anyway

Logs available (can attach if helpful):

  • ~/.claude/remote-control.log (bridge)
  • ~/.claude/remote-control-cse_<id>.log (per-session SDK debug)

Screenshot: Banner is visible alongside the rendered assistant response (session is alive while banner claims disconnect).

extent analysis

TL;DR

The most likely fix is to modify the desktop app to not send the initialize control request when the SDK is launched in stream-json mode, which auto-initializes.

Guidance

  • Verify that the issue is indeed caused by the control_response {subtype: "error", error: "Already initialized"} message being treated as a fatal disconnect by checking the bridge logs for this specific error sequence.
  • Consider modifying the app to check the SDK's launch mode before sending the initialize request, and skip it if the SDK is already initialized.
  • Alternatively, the SDK could be modified to treat a duplicate initialize request as a no-op success, but this might require changes to the SDK's internal state management.
  • To mitigate the issue, the app could be updated to not display the "Remote Control disconnected" banner when receiving an "Already initialized" error response.

Example

No code snippet is provided as the necessary changes depend on the internal implementation of the desktop app and the SDK.

Notes

The provided logs and diagnosis suggest that the issue is caused by the app's handling of the "Already initialized" error response. However, without access to the app's source code, it's difficult to provide a precise fix.

Recommendation

Apply a workaround by modifying the desktop app to not send the initialize control request when the SDK is launched in stream-json mode, as this mode auto-initializes and the request is unnecessary. This change should prevent the "Remote Control disconnected" banner from being displayed incorrectly.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Remote Control sessions show "Remote Control disconnected" banner on first turn despite session succeeding (control_response error="Already initialized") [2 comments, 3 participants]