claude-code - 💡(How to fix) Fix [Bug] Claude Desktop webview hangs on session switch with concurrent MCP server operations [5 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#51649Fetched 2026-04-22 07:56:37
View on GitHub
Comments
5
Participants
3
Timeline
10
Reactions
0
Author
Timeline (top)
commented ×5labeled ×5

Code Example

[]
RAW_BUFFERClick to expand / collapse

Bug Description Bug: Claude Desktop webview hangs and auto-restarts when switching between Claude Code sessions

Env: Claude Desktop 1.3561.0 / CCD 2.1.111 / macOS 26.3 (25D125) / Apple Silicon / Node 24.14.0

Symptom: Window goes blank for several seconds and app auto-restarts when I switch sessions in the sidebar. 11 occurrences in ~3 days (1 on 04-19, 8 on 04-20, 2 on 04-21 by 11:14 local).

Log signature: main.log shows Main webview is unresponsive, will kill and reload followed by two Sentry captures (Main webview became unresponsive and No message, both with stack: undefined) then a full beforeQuit cleanup and relaunch.

Correlation with session switch (from ~/Library/Logs/Claude/main.log):

04-20 13:25:35 setFocusedSession → 13:25:51 unresponsive (+16s) 04-20 19:59:01 setFocusedSession → 19:59:16 unresponsive (+15s) 04-21 11:05:53 setFocusedSession + replaceRemoteMcpServers (6 servers) → 11:06:28 unresponsive (+35s) 04-21 11:13:38 setFocusedSession + session warming + 3× LocalPluginsReader.Found 2 local plugins + checkGhAvailable + getPrStateForBranch → 11:13:55 unresponsive (+17s) Sentry event IDs (stack empty on client, but envelopes should be on your side): 2c7d8dffb09c40709a7e23d929be73af, 1f0e2cc0bb5e4c6cab380c6947be653a, 2417865d2c804b188b8fe9d72892a01c, abc7c87591764f5b85568e092ca6f8f8, e5904b50ced840e18c8e1463fb568953, 3afb8aa25b7d4994bdb9cadbf869bde0, 6ea688ea1c9e40cf860271f9048e07e0, fdc7a5d05f4f4682a228df95a19d1456, a6701a658f0d4f8f89fd72e54fadd062, 714fa2218c9c4f399af09dc3505aa87f, 05ee1e1586ce4c43a2a89c473dc8aba9.

Related macOS microstackshot (likely same code path): /Library/Logs/DiagnosticReports/Claude Helper_2026-04-17-095836_Chriss-MacBook-Pro.diag — flagged Claude Helper for 2.1 GB file-backed writes over 17h. Hot stack: v8::MicrotasksScope → node::PrincipalRealm... → temporal_rs... → cppgc → pwrite/fsync. Sustained filesystem I/O from the renderer.

Setup: 2 local Claude Code sessions on a worktree, 6 MCP servers (Claude in Chrome, mcp-registry, Claude Preview, ccd_session, ccd_directory, scheduled-tasks), 3 plugins (skills:1, local:2).

Investigation angle: The session-switch path fires a synchronous burst on focus — stopSideChat → two setFocusedSession calls (first to null) → 2–3× LocalPluginsReader → oauth token lookup → replaceRemoteMcpServers (SDK call with 6 servers) → Warming session → checkGhAvailable → getPrStateForBranch. Moving the filesystem/IPC work off the renderer main thread or spreading it across microtasks should stop Electron's hang detector from tripping.

Minor inconsistency noticed: log shows replaceRemoteMcpServers: sessionId=…, serverCount=0 but the next line passes 6 servers to the SDK — possible mislabeled log.

Happy to share main.log (~7.5 MB) if useful.

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 2.1.116
  • Feedback ID: 5d1d681b-27e7-4d06-aec5-a9190c235557

Errors

[]

extent analysis

TL;DR

The issue can likely be resolved by moving the synchronous burst of filesystem and IPC work off the renderer main thread to prevent Electron's hang detector from tripping.

Guidance

  • Investigate the session-switch path to identify opportunities to move synchronous work off the main thread, such as using microtasks or asynchronous calls for replaceRemoteMcpServers, LocalPluginsReader, oauth token lookup, and other blocking operations.
  • Review the log signature to understand the sequence of events leading to the hang and auto-restart, focusing on the setFocusedSession calls and the subsequent synchronous burst of work.
  • Consider spreading the workload across microtasks to prevent the hang detector from tripping, as suggested in the investigation angle.
  • Verify that the replaceRemoteMcpServers log message accurately reflects the number of servers being passed to the SDK, as there is a noticed inconsistency.

Example

No code snippet is provided, as the issue description does not include specific code that can be modified to fix the issue.

Notes

The provided information suggests that the issue is related to the synchronous nature of the session-switch path, but without access to the codebase or more detailed logs, it is difficult to provide a more specific solution.

Recommendation

Apply a workaround by moving the synchronous burst of work off the main thread, as this is likely to prevent the hang detector from tripping and resolve the issue. This approach is suggested in the investigation angle and is consistent with the log signature and error messages.

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 [Bug] Claude Desktop webview hangs on session switch with concurrent MCP server operations [5 comments, 3 participants]