VS Code: after an extension host restart, Claude panels never re-attach, so every session in the window looks frozen until Reload Window
Environment
- Claude Code VS Code extension 2.1.272 (CLI 2.1.270)
- VS Code 1.136.1 (stable), single window, single-folder workspace
- Windows 11 Pro, build 26200
What happened
Three Claude Code sessions were running in panels of one VS Code window. The window's extension host was restarted (the logs show a renderer-initiated terminate; it followed an extension being disabled from the Extensions view). Every session stopped at the same second and never processed input again. Each panel kept showing its last state — one mid-tool-call, one mid-response — with no error, no "session ended" notice and no way to continue. The sessions were not hung: the CLI processes had exited cleanly. Only a window reload (here, a full PC restart) recovered them; the transcripts were intact and --resume worked afterwards.
Evidence (log excerpts, local time, paths and ids removed)
08:20:22.433 Claude VSCode.log Stream started - received first chunk <- last CLI output relayed
08:20:22.533 exthost.log Extension host terminating: received terminate message from renderer
08:20:23.17 exthost.log Channel has been closed (claude-code: shutdown -> closeAllChannels -> closeChannel)
08:20:23.5-25 claude MCP logs Terminating MCP server process tree / connection closed (cleanly) x4 CLI processes
08:20:25.085 main.log Extension host with pid <old> exited with code: 0
08:20:23.373 renderer.log Started local extension host with pid <new>
08:20:48.569 Claude VSCode.log AuthManager initialized / extension is now active / MCP Server running on port <n>
(no further Claude log lines; no panel ever sent `init` to the new host)
Windows showed no sleep, crash, memory pressure or network change in that window, and a separate non-VS Code process tree kept running normally.
Expected
When the extension reactivates in a new host, open panels either re-attach to their sessions, or clearly show the session ended with a one-click resume.
Actual
Panels keep rendering dead sessions as live. Nothing indicates the session is gone, so the natural reaction is to wait or restart the machine.
Reproduction (inferred from the logs above, not yet re-run in isolation)
- Open one or more Claude Code panels and start a long-running task in each.
- Disable any other active extension in the Extensions view and accept Restart Extensions (or run Developer: Restart Extension Host).
- Observe the Claude panels.
Workaround
Developer: Reload Window, then reopen each session from the panel's session history.
Possibly related
#79921 (sessions freeze locally until another session receives input), #75571 (extension hangs tied to the extension host IPC layer) — different trigger, same user-visible symptom.
3 Comments
Confirming this on Windows 11, and the trigger here was the routine "Restart Extensions" prompt that VS Code shows after an unrelated extension auto-updates. No extension was disabled manually.
Environment
What I did
@restartrequiredlisted only Pylance. The Claude Code extension itself was not updated (still 2.1.280).Logs from step 3 (local time, paths removed)
The panel never recovered. Same sequence as in the report above (renderer-initiated terminate, extension reactivates in the new host, the panel never sends
init).Why I think this matters
Not verified
Workaround
Not clicking "Restart Extensions" avoided the problem for the 4.5 hours I tested. After a hang, restarting the window recovers it (as noted in the report).
Same signature on a plain cold start of VS Code, with no extension host restart in that session.
Environment
2a59476c9b), single window, single-folder workspacewin32-x64)What happened
I closed VS Code and started it again. The Claude panel never connected. Starting VS Code once more fixed it. From the user's side this happens intermittently: one restart fails, the next one usually works.
Evidence (local time, UTC+9)
Failing session — this is the whole
Claude VSCode.log(9 lines):No
Received message from webviewline at all, so no webview ever sentinit, and noLaunching Claude/Spawning Claudefollowed. I quit VS Code at 11:42:55.renderer.log:Started local extension hostappears once. There is no second host and no host exit until shutdown.exthost.log: the extension was activated byonWebviewPanel:claudeVSCodePanel(an editor-area Claude tab being restored).Next start, about a minute later (works). Activation was
onView:claudeVSCodeSidebarSecondary, andinitarrives at once:Notes
onWebviewPanelactivation does not always fail. In the session before the failing one, a restarted host was also activated byonWebviewPanel:claudeVSCodePaneland receivedinit2 s later. So the restored-panel activation path is the context of the failure, not a proven cause.renderer.loglogsAuto updating outdated extensions. anthropic.claude-codeshortly after startup. The installed version stayed at 2.1.294 throughout.initnever arrived.Expected: a restored panel or sidebar sends
initto the active host. If the handshake doesn't complete, the panel should show an error or retry, instead of waiting forever.Workaround: restart VS Code (or Developer: Reload Window).
Correction to my comment above: in my case this was not a Claude Code bug, and not the same cause as this issue. Please disregard my cold-start report.
I found the cause on the same machine. In each failed start, the whole webview layer of that VS Code window was broken, because the window had been started while the previous VS Code instance was still shutting down. That instance was kept alive for about 6 seconds by another extension (Cline), which loops at shutdown (cline/cline#13197). While the old process still holds the profile, the new instance cannot open the Service Worker database, so every webview in that window fails with
Could not register service worker: InvalidStateError. The Claude panel is one of those webviews, so the extension is active butinitnever arrives. Reloading the window does not help; restarting VS Code after the old process has exited does.deactivate()takes longer than 5 s. Starting VS Code 1 s after closing it broke the webview; starting it after the old process had exited did not.If someone else sees "extension active, but no
initfrom the panel" right after restarting VS Code, these are worth checking:main.log, isExtension host with pid ... exitedlogged after the new session started?%APPDATA%\Code\Service Worker\Database\LOG(orLOG.old) 0 bytes with the time of the failed start?