Introduction
VS Code extensions can crash for various reasons, leaving you with unresponsive features or cryptic error messages like "Extension host terminated unexpectedly." This often happens after updates, conflicts between extensions, or resource constraints. Let me walk you through diagnosing and fixing these crashes systematically.
Recognizing Extension Crashes
When an extension crashes, you might see:
Extension host terminated unexpectedly.
The extension 'publisher.extension-name' has been disabled.Or in the Output panel (select "Extension Host" from dropdown):
[error] Extension 'ms-python.python' has crashed.
[error] ExtensionHostProcess exited with code 1Other symptoms include:
- Features suddenly stop working (IntelliSense, debugging, linting)
- High CPU or memory usage in Code Helper processes
- VS Code becomes unresponsive for seconds at a time
Quick Diagnosis
Open the Developer Tools to see detailed crash logs:
Press Ctrl+Shift+I (Windows/Linux) or Cmd+Option+I (Mac), then check the Console tab for red error messages.
You can also view extension host logs:
Press Ctrl+Shift+U to open Output, then select "Extension Host" from the dropdown.
Step-by-Step Fix
Step 1: Identify the Crashing Extension
Open the Extensions view with Ctrl+Shift+X and look for extensions with warning icons or "Disabled" labels.
For a more thorough check, open Command Palette (Ctrl+Shift+P) and run:
Developer: Show Running ExtensionsThis displays all active extensions. Extensions that recently crashed won't appear here, but you'll see them in the Problems panel.
Step 2: Check Extension Logs
Run this command to see detailed extension logs:
Developer: Open Extensions Logs FolderLook for files named after your extensions. Open them and search for "error", "crash", or "exception".
Step 3: Isolate the Problem Extension
If you can't identify the culprit from logs, use binary search:
- 1.Disable all extensions:
Extensions: Disable All Installed Extensions - 2.Restart VS Code
- 3.Enable extensions one by one (or in groups)
- 4.Restart after each batch to identify which causes the crash
Alternatively, start VS Code with all extensions disabled:
code --disable-extensionsIf the crash stops, you know an extension is responsible.
Step 4: Fix the Problem Extension
Once identified, try these solutions:
Update the extension:
``json
// In settings.json
"extensions.autoUpdate": true,
"extensions.autoCheckUpdates": true
Clear extension cache: ```bash # Windows rd /s /q "%USERPROFILE%\.vscode\extensions\.obsolete" rd /s /q "%APPDATA%\Code\Cache" rd /s /q "%APPDATA%\Code\CachedData"
# macOS/Linux rm -rf ~/.vscode/extensions/.obsolete rm -rf ~/.config/Code/Cache rm -rf ~/.config/Code/CachedData ```
- 1.Reinstall the extension:
- 2.Uninstall from Extensions view
- 3.Restart VS Code
- 4.Reinstall from marketplace
Step 5: Fix Extension Conflicts
Some extensions conflict with each other. Common conflict pairs: - Multiple Python formatters (Black, autopep8, yapf) - Multiple linters for the same language - Git-related extensions (GitLens + Git Graph conflicts) - Theme extensions that override each other
Configure which extension handles what:
// settings.json - Specify which formatter to use
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.provider": "none"Step 6: Adjust Extension Host Settings
If crashes persist, modify these settings:
// settings.json
"extensions.supportUntrustedWorkspaces": {
"enabled": true,
"recommendations": false
},
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/**": true
}For memory-related crashes, increase the extension host limit:
// settings.json
"extensions.experimental.affinity": {
"ms-python.python": 1
}Step 7: Check for Workspace-Specific Issues
Some crashes only occur in specific workspaces due to large file counts or special configurations.
Check your workspace settings:
// .vscode/settings.json in your project
"files.exclude": {
"**/__pycache__": true,
"**/.git": true,
"**/node_modules": true,
"**/.venv": true
},
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true
}Common Crash Scenarios
Python Extension Crashes
The Python extension often crashes when analyzing large virtual environments:
// settings.json
"python.analysis.exclude": [
"**/node_modules",
"**/.venv",
"**/venv",
"**/__pycache__"
],
"python.analysis.diagnosticSeverityOverrides": {
"reportUnusedImport": "none"
}TypeScript/JavaScript Extension Crashes
Large monorepos can overwhelm the TypeScript server:
// settings.json
"typescript.tsserver.maxTsServerMemory": 8192,
"typescript.survey.enabled": false,
"javascript.suggestionActions.enabled": falseGit Extension Crashes
Large repositories cause Git extension timeouts:
// settings.json
"git.enableSmartCommit": false,
"git.autorefresh": false,
"git.decorations.enabled": falseVerification
After applying fixes, verify the extension works:
- 1.Open Command Palette (
Ctrl+Shift+P) - 2.Run commands provided by the extension
- 3.Check Output panel for the extension
- 4.Monitor CPU/memory usage in Task Manager (Windows) or Activity Monitor (Mac)
Prevention Tips
- Keep extensions updated but wait a few days after major releases
- Disable extensions you don't actively use
- Use workspace-specific extension recommendations instead of global installs
- Regularly clean the extension cache
- Monitor extension host memory with
Process Explorer(Help > Open Process Explorer)
Related Issues
- VS Code Settings Sync Not Working
- VS Code Performance Issues
- VS Code Extension Host Memory
- VS Code Workspace Storage Error