How To Fix the “Window Terminated Unexpectedly” Error in Visual Studio Code

The “window terminated unexpectedly” error in Visual Studio Code pops up when one of the Electron renderer processes crashes or gets forcefully shut down by the system. For those unfamiliar, VS Code relies on Electron, which uses Chromium behind the scenes to render its interface — kinda like a mini browser inside your editor. Each window runs in its own separate renderer process. So when something goes wrong there, you get a crash message. This can be super annoying, especially when it starts happening on startup or when loading specific projects.

You might see different error codes, like:

  • reason: ‘crashed’, code: ‘1073741819’ or ‘6’
  • reason: ‘oom’ (Out of Memory), code: ‘-536870904’
  • reason: ‘killed’, code: ‘9’

Most of the time, these crashes boil down to outdated graphics drivers, problematic extensions, bugs in Electron/Chromium, corrupted cache or backup files, or sometimes a particular project file throws a fit. Not sure why it happens, but it’s a mix of system stability and application quirks. Anyway, here are some solid fixes that have helped in my experience — each one targets a common cause.

1. Restart Your Computer

Yeah, sounds basic, but it’s often the first line of defense. Restarting clears out frozen processes, refreshes GPU drivers, and resets memory. Sometimes, Electron just needs a fresh start to shake off whatever caused a crash.

Just hit Start menu > Power > Restart. On some setups, this fixes crashes for a while, but it’s worth trying again if the problem keeps coming back.

2. Delete the Backup Folder

VS Code keeps backup copies of your unsaved files somewhere in %appdata%.If those get corrupted, it could trigger the window crashes when launching.

Warning: This will erase any unsaved work, so only do it if you’re okay losing those temporary backups.

Press Windows + R, type %appdata%, hit Enter, then go into Code > Backups. Delete that entire folder, then restart VS Code and see if it opens normally. Worked on some setups, but not all — so worth a shot.

3. Disable the Chromium Sandbox (Advanced)

This is kinda tricky and *not* recommended long-term because it weakens security. But sometimes, Electron’s sandbox conflicts with graphics drivers or security software, causing renderer crashes.

Close all VS Code windows, then run Command Prompt as Administrator. Type:

code --disable-chromium-sandbox

and hit Enter. Now, start VS Code again. If crashes stop, you’ve likely found a culprit. Just remember, this reduces some security protections, so don’t leave it permanently unless you’re confident in your environment.

4. Force Close VS Code

Sometimes, even after closing it, some processes linger in the background. These leftovers can cause weird issues on restart. To be sure, force-closing ensures VS Code starts fresh.

Press Ctrl + Shift + Esc to open Task Manager, find Visual Studio Code under the Processes tab, right-click, and pick End Task. Then open VS Code again. On some systems, this fixes crashes that keep recurring after a normal close.

5. Reinstall VS Code

If all else fails, wiping out and reinstalling might do the trick. Especially if you suspect a corrupted Electron or Chromium component, a fresh install often resets everything back to sane.

Uninstall VS Code, then delete leftover app data at C:\Users\\AppData\Roaming\Code (because of course, Windows has to make it harder than necessary).Download the latest installer from the official VS Code website and install again.