Fix VSCode Extension Host Terminated Unexpectedly

Programming & Dev Tools Intermediate 👁 22 views 📅 May 25, 2026

VSCode shows 'Extension host terminated unexpectedly' due to faulty extensions, memory limits, or corrupted data. This guide covers diagnosis, step-by-step fixes, and prevention.

Symptoms

Users experience a popup error stating 'Extension host terminated unexpectedly' in Visual Studio Code. The editor may become unresponsive, extensions stop working, and features like IntelliSense, debugging, or syntax highlighting fail. This can occur on startup or while using specific extensions.

Root Causes

  • Faulty Extensions: A buggy or incompatible extension crashes the extension host process.
  • Memory Limits: The extension host exceeds available memory, especially on systems with limited RAM or when many extensions run.
  • Corrupted Data: Corrupted extension cache, user data, or settings files.
  • Outdated VSCode or Extensions: Version mismatches cause instability.
  • System Resource Contention: Other applications consuming CPU or memory interfere with VSCode.

Step-by-Step Fix

1. Restart VSCode and Reload Window

  1. Close all VSCode windows and reopen.
  2. If error persists, use Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac) and run Developer: Reload Window.

2. Disable All Extensions

  1. Launch VSCode from command line in safe mode: code --disable-extensions.
  2. If error disappears, an extension is the culprit. Re-enable extensions one by one to identify the problematic one.

3. Increase Extension Host Memory

  1. Open settings (Ctrl+, or Cmd+,).
  2. Search for extensions.experimental.affinity or set extensions.experimental.affinity to {}.
  3. Alternatively, add "extensions.experimental.affinity": { "*": 1 } to settings.json to allocate more memory.

4. Clear Extension Cache and Data

  1. Close VSCode.
  2. Navigate to extension cache folder:
    • Windows: %USERPROFILE%\.vscode\extensions
    • Mac/Linux: ~/.vscode/extensions
  3. Delete the CachedExtensionVSIXs folder if present.
  4. Delete the extensions folder (reinstall extensions later).

5. Update VSCode and Extensions

  1. Check for VSCode updates: Help > Check for Updates.
  2. Update all extensions: Extensions view (Ctrl+Shift+X), click ... > Check for Extension Updates.

6. Reset User Data

  1. Backup and delete the user data folder:
    • Windows: %APPDATA%\Code
    • Mac: ~/Library/Application Support/Code
    • Linux: ~/.config/Code
  2. Restart VSCode (settings and extensions will reset).

Alternative Fixes

  • Use a Different Workspace: Open a new folder or project to rule out workspace-specific corruption.
  • Disable GPU Acceleration: Add "disable-hardware-acceleration": true to settings.json.
  • Reinstall VSCode: Uninstall completely (including user data) and install the latest version.
  • Check System Resources: Close memory-heavy applications (browsers, Docker, etc.) and try again.

Prevention

  • Regularly Update: Keep VSCode and extensions up to date.
  • Limit Extensions: Only install necessary extensions; disable unused ones.
  • Monitor Memory: Use task manager or activity monitor to watch VSCode memory usage.
  • Backup Settings: Sync settings via GitHub or Settings Sync extension.
  • Use Profiles: Create separate profiles for different development environments to isolate extension issues.

Technical Details

The extension host is a separate Node.js process that runs all extensions. When it crashes, VSCode attempts to restart it automatically. Persistent crashes indicate a deeper issue. The error can be logged in the developer console (Help > Toggle Developer Tools) under the Console tab. Look for red error messages or stack traces pointing to specific extensions. Common culprits include language servers (Python, TypeScript), linters, and themes with complex logic.

Extension TypeCommon Issues
Language SupportOutdated language server, large files
DebuggersIncompatible runtime versions
Themes/UIMemory leaks from custom CSS
LintersConfiguration conflicts

For persistent issues, report the bug to the extension developer with the developer console logs.

Was this solution helpful?