[BUG] Claude Code VS Code Extension Crashes on Startup - Host Extension Unexpectedly Closed
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
he Claude Code VS Code extension crashes within seconds of starting up, displaying the message "host extension unexpectedly closed." The extension becomes unresponsive and requires restarting VS Code.
What Should Happen?
The extension should load successfully and remain stable, allowing normal interaction with Claude Code through the VS Code interface.
Error Messages/Logs
The host server terminated unexpectedly
Steps to Reproduce
- Open VS Code with Claude Code extension installed
- Click the Spark icon in the sidebar to open Claude Code panel
- Extension starts loading
- Within a few seconds, extension crashes with "host extension unexpectedly closed" message
- Extension becomes non-functional
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.0.0
Claude Code Version
2.0.10
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
Troubleshooting Steps Attempted
- Restarted VS Code multiple times
- Disabled other extensions to check for conflicts
- Cleared extension data/cache
- Reinstalled Claude Code extension
Additional Context
The extension worked previously but started crashing recently. The issue appears to be specifically related to conversation history loading, as the crash occurs during the initial loading phase.
Feature Request
If possible, could you provide an option to disable conversation history loading on startup, or implement lazy loading for conversation history to prevent startup crashes?
22 Comments
Have the same issue !
Also have the same issue.
Does it happen to you in all VS Code projects?
Outside the project folder, I can launch the extension and work with the project files. If I start the extension inside the Next.js project folder, it breaks Next.js, so I only use the command line terminal there.
Yes it happens when I open a VScode folder and then use the tab. The claude terminal works fine even from VScode, its just the extension that causes crashes.
Same issue, and terminal also works, but IDE is a non-starter now.
I was able to resolve this by deleting everything in the project folder (c:\\Users\ -my folder- \.claude\projects). I had to reauthenticate in terminal, but then it worked in IDE. This is a very heavy solution, and absolutely no warning that this would be required, and the Claude help desk AI had no recommendation of this. This shouldn't be the required solution either.
just tried @Deekow solution and it didn't work, and neither asked for re-auth on terminal.
this happens on macos as well
please guide on getting more data so that it can be reproduced successfully and fixed
i have been suffering with this for past 2 weeks now
i have to reinstall everything on a daily basis which is stupid
how can i help you guys fix this? what do you need?
give steps/commands, so that i can help debug this
is there a debugging process outlined for claude code extension?
INFO Started local extension host with pid 9729.
console.ts:139 [Extension Host] Created lock file at /Users/nm/.claude/ide/12495.lock
console.ts:139 [Extension Host] Set CLAUDE_CODE_SSE_PORT=12495 in terminal environment (in-memory)
console.ts:139 [Extension Host] Set ENABLE_IDE_INTEGRATION=true in terminal environment (in-memory)
log.ts:460 ERR [Extension Host] (node:9729) [DEP0040] DeprecationWarning: The
punycodemodule is deprecated. Please use a userland alternative instead.(Use
Code Helper (Plugin) --trace-deprecation ...to show where the warning was created)error @ log.ts:460
error @ log.ts:565
error @ logService.ts:51
mCs @ remoteConsoleUtil.ts:58
$logExtensionHostMessage @ mainThreadConsole.ts:38
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
C @ event.ts:1201
fire @ event.ts:1232
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:383
console.ts:139 [Extension Host] (node:9729) [DEP0040] DeprecationWarning: The
punycodemodule is deprecated. Please use a userland alternative instead.(Use
Code Helper (Plugin) --trace-deprecation ...to show where the warning was created)gCs @ console.ts:139
$logExtensionHostMessage @ mainThreadConsole.ts:39
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
C @ event.ts:1201
fire @ event.ts:1232
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:383
webviewElement.ts:489 An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing.
mountTo @ webviewElement.ts:489
P @ overlayWebview.ts:250
claim @ overlayWebview.ts:136
claim @ webviewEditorInput.ts:160
hb @ webviewEditor.ts:172
setInput @ webviewEditor.ts:163
await in setInput
S @ editorPanes.ts:464
L @ editorPanes.ts:259
openEditor @ editorPanes.ts:136
(anonymous) @ editorGroupView.ts:1260
Lb @ editorGroupView.ts:1284
Kb @ editorGroupView.ts:1242
openEditor @ editorGroupView.ts:1146
openEditor @ editorService.ts:582
openWebview @ webviewWorkbenchService.ts:283
$createWebviewPanel @ mainThreadWebviewPanels.ts:166
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
C @ event.ts:1201
fire @ event.ts:1232
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:383
localProcessExtensionHost.ts:280 Extension Host
localProcessExtensionHost.ts:281 <--- Last few GCs --->[9729:0x11c00330000] 27150 ms: Mark-Compact (reduce) 2045.8 (2073.2) -> 2045.8 (2072.9) MB, pooled: 0.0 MB, 13.42 / 0.00 ms (+ 1.0 ms in 2 steps since start of marking, biggest step 0.9 ms, walltime since start of marking 19 ms) (average mu = 0.866, cu[9729:0x11c00330000] 27180 ms: Mark-Compact 2048.0 (2075.0) -> 2048.0 (2075.5) MB, pooled: 0.0 MB, 28.00 / 0.00 ms (average mu = 0.721, current mu = 0.081) allocation failure; scavenge might not succeed[9729:1128/153755.819829:ERROR:electron/shell/common/node_bindings.cc:178] OOM error in V8: Reached heap limit Allocation failed - JavaScript heap out of memory
abstractExtensionService.ts:843 Extension host (LocalProcess pid: 9729) terminated unexpectedly. Code: 5, Signal: unknown
zb @ abstractExtensionService.ts:843
zb @ nativeExtensionService.ts:160
yb @ abstractExtensionService.ts:835
(anonymous) @ abstractExtensionService.ts:808
C @ event.ts:1201
fire @ event.ts:1232
J @ localProcessExtensionHost.ts:530
(anonymous) @ localProcessExtensionHost.ts:289
C @ event.ts:1201
fire @ event.ts:1232
l @ ipc.ts:688
t @ ipc.ts:756
s @ ipc.ts:745
(anonymous) @ ipc.ts:547
C @ event.ts:1201
D @ event.ts:1212
fire @ event.ts:1236
ue @ event.ts:574
emit @ VM1700 sandbox_bundle:2
onMessage @ VM1700 sandbox_bundle:2
log.ts:460 ERR Extension host (LocalProcess pid: 9729) terminated unexpectedly. The following extensions were running: vscode.github-authentication, vscode.terminal-suggest, vscode.git-base, mhutchie.git-graph, vscode.npm, vscode.git, vscode.github, vscode.debug-auto-launch, vscode.merge-conflict, Anthropic.claude-code, vscode.emmet, vscode.extension-editing, vscode.markdown-language-features, vscode.markdown-math, vscode.configuration-editing, vscode.json-language-features, vscode.typescript-language-features
error @ log.ts:460
error @ log.ts:565
error @ logService.ts:51
Cb @ abstractExtensionService.ts:908
zb @ nativeExtensionService.ts:180
yb @ abstractExtensionService.ts:835
(anonymous) @ abstractExtensionService.ts:808
C @ event.ts:1201
fire @ event.ts:1232
J @ localProcessExtensionHost.ts:530
(anonymous) @ localProcessExtensionHost.ts:289
C @ event.ts:1201
fire @ event.ts:1232
l @ ipc.ts:688
t @ ipc.ts:756
s @ ipc.ts:745
(anonymous) @ ipc.ts:547
C @ event.ts:1201
D @ event.ts:1212
fire @ event.ts:1236
ue @ event.ts:574
emit @ VM1700 sandbox_bundle:2
onMessage @ VM1700 sandbox_bundle:2
log.ts:440 INFO Automatically restarting the extension host.
this is really frustrating, paying for 200 dollar a month, endup it keep happing something like this, already facing this kind of problem couple of time in within 1 and half month. And there is no solution for this, no customer service support, claude will reply you after 7-9 days, speechless.
I decided to switch to Antigravity, and there the Claude Code extension works fine in the same project. So I think it's a VS Code issue.
Even so, I'm still using the terminal within Antigravity often because I feel the extension limits Claude Code's capabilities.
I found the root cause! The conversations history is the biggest problem, when you open the project, the extension tries to load all the conversation history into memory, which causes it to crash with "extension host terminated. Just remove it and backup it out of the project, restart your vscode, problem fixed. You can either only keep last 1 week or 2 week chat history, it work too.
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Still Happening today, it's a nightmare when we have work to do.
Identifier: anthropic.claude-code
Version: 2.1.4
This is still not fixed! Makes using VS Code impossible
@YodasMyDad have you tried the suggestion above to purge the conversation history in ~/.claude/projects ?
I have been having this issue in VSCode and this just worked for me 👍
@tankinnen no I haven't, thanks. I'll give it a try!
Had the same issue. Used Claude Code (CLI) to investigate and found the root cause: a few very heavy session log files under ~/.claude/projects/one-of-my-projects/.
In my case, 9 session logs over 50MB each (totaling 2.1GB) were enough to make the VS Code extension fail to load.
After moving just those 9 files out of the project folder, the extension started working immediately. No need to delete the entire ~/.claude/projects directory — just the heavy session logs.
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.