The Error
You're mid-session, editing code, and VS Code freezes up. Then the notification drops:
Extension host terminated unexpectedly. Please reload the window.
IntelliSense stops. Syntax highlighting vanishes. Your language server is gone. Clicking "Reload Window" fixes it โ for a while. Then it crashes again.
What's Actually Happening
VS Code runs all extensions in a dedicated Node.js process called the extension host. When that process dies โ from an unhandled exception, memory overflow, or native crash โ VS Code can't recover it automatically and throws this error.
The usual suspects:
- One extension has a bug or slow memory leak
- Two extensions conflict with each other
- The extension host hits its Node.js memory cap on large workspaces
- Corrupted extension files from a failed update
- Incompatible native Node.js modules bundled inside an extension
- Workspaces with 50,000+ files overwhelming the file watcher
Fix 1: Read the Extension Host Logs First
Don't start disabling things randomly. Get the actual crash reason. Open the Output panel:
Ctrl+Shift+U (Windows/Linux)
Cmd+Shift+U (macOS)
Switch the dropdown from "Tasks" to "Extension Host". Scan for stack traces, Error: lines, or "out of memory" messages. Nine times out of ten, this tells you exactly which extension is misbehaving.
For deeper digging, open the Developer Tools console:
Help โ Toggle Developer Tools โ Console tab
Filter by Errors and look for any extension name in the output.
Fix 2: Isolate the Problem โ Disable All Extensions
Launch VS Code with all extensions off:
# From terminal
code --disable-extensions
# Or from inside VS Code:
Ctrl+Shift+P โ "Open New Window with Extensions Disabled"
Crash gone? An extension is definitely causing it. Still crashing with no extensions? Skip straight to Fix 5.
Fix 3: Bisect to Find the Bad Extension
Testing 30+ extensions one by one is tedious. Skip the manual hunt and use VS Code's built-in bisect instead:
Ctrl+Shift+P โ "Start Extension Bisect"
VS Code disables half your extensions, then asks: still broken? You answer yes or no. It narrows the field in O(log n) steps โ typically 5โ6 rounds to isolate the culprit from 30+ extensions.
Once you've found it, your options are:
- Disable it permanently
- Check its GitHub Issues page for a known fix or workaround
- Roll back via the Extensions panel โ gear icon โ "Install Another Version"
Fix 4: Clear the Extension Cache
Corrupted extension files can trigger repeated crashes even after updating. Delete the cached folder for the problematic extension:
Windows:
%USERPROFILE%\.vscode\extensions
macOS/Linux:
~/.vscode/extensions
Find the specific extension folder (e.g., ms-python.python-2024.x.x), delete it, then reinstall from the Extensions panel. Avoid wiping the entire extensions folder unless you're prepared to reinstall everything from scratch.
The obsolete cache is worth clearing too:
# macOS/Linux
rm -rf ~/.vscode/extensions/.obsolete
# Windows (PowerShell)
Remove-Item "$env:USERPROFILE\.vscode\extensions\.obsolete" -Force
Fix 5: Isolate Extensions and Increase Memory
Two separate tactics here, both useful when you have many heavy extensions loaded at once.
Tactic A โ Process isolation with affinity. By default, all extensions share a single extension host process. If one extension crashes, it takes the whole host down. The affinity setting moves specific extensions into their own process, so a crash stays contained:
{
"extensions.experimental.affinity": {
"vscodevim.vim": 1
}
}
Add this to your settings.json for any extension that frequently causes trouble. Group number 1 puts it in a separate host; use 2, 3, etc. to create additional isolated groups.
Tactic B โ Raise the Node.js memory limit. With extensions like Pylance, GitHub Copilot, or large TypeScript language servers, the extension host can hit Node.js's default ~1.5 GB memory cap. Raise it by editing argv.json:
Ctrl+Shift+P โ "Configure Runtime Arguments"
Add:
{
"js-flags": "--max-old-space-size=4096"
}
That sets the limit to 4 GB. Restart VS Code fully after saving โ a window reload isn't enough here.
Fix 6: Check File Watcher Limits (Linux Only)
On Linux, workspaces with tens of thousands of files can exhaust the system-level file watcher limit and destabilize the extension host. Check your current limit:
cat /proc/sys/fs/inotify/max_user_watches
A value like 8192 is too low for large projects. Raise it permanently:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
Pair that with exclusions in .vscode/settings.json so VS Code isn't watching folders it doesn't need:
{
"files.watcherExclude": {
"**/node_modules/**": true,
"**/.git/**": true,
"**/dist/**": true,
"**/__pycache__/**": true
}
}
Fix 7: Clean Reinstall VS Code
Still crashing after all of the above? The VS Code installation itself may be corrupted. A clean reinstall takes about 10 minutes and rules out everything at once:
- Uninstall VS Code
- Delete leftover config directories:
~/.vscodeand~/.config/Codeon Linux/macOS, or%APPDATA%\Codeon Windows - Download and install the latest stable from code.visualstudio.com
- Reinstall extensions in small batches, testing for a few minutes between each batch
How to Confirm the Fix Worked
Give the fix at least 15โ20 minutes of real work before declaring victory. You're looking for:
- IntelliSense and autocomplete responding normally
- No "Extension host terminated" notification
- A clean Output โ Extension Host log (no red errors)
- Language servers (Python, TypeScript, etc.) staying connected throughout
On Linux/macOS, you can watch the extension host process directly:
watch -n 5 'ps aux | grep extensionHost | grep -v grep'
A stable process ID that doesn't change every few minutes means the crash is gone.
Prevention
- Keep VS Code updated โ most crash bugs get patched in minor releases within days
- Audit your extensions every few months โ anything unused in 3+ months is dead weight worth removing
- Use Profiles (VS Code 1.75+) to create separate extension sets per project type โ no Python extensions open in a Go project, no Go tooling in a Python one
- Read changelogs before updating extensions โ community bug reports often surface regressions within hours of a bad release
- Exclude large generated folders from file watching proactively โ
node_modules,dist,.git, virtual environments โ before problems start

