Main process doesn't exit on fatal startup errors in onReady

Open
#320,760 0 comments 0 reactions 1 assignee View on GitHub

@deepak1556 is already working on this.

Since Jun 10, 2026.

Assessment

This issue has not been assessed yet.

Description

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: Built from source (latest main)
  • OS Version: Windows 11 / macOS / Linux

Steps to Reproduce:

  1. Open src/main.ts and locate the onReady() function.
  2. Inject a simulated fatal error inside the try block before startup() is called (e.g., throw new Error("Simulated core failure");).
  3. Run the application locally using .\scripts\code.bat (or .sh).
  4. Check the terminal and your OS task manager. The error is caught and logged to the console, but the application does not exit. The main Electron process is left hanging in the background.

Problem & Proposed Solution:
If something critical fails during bootstrapper initialization (e.g., mkdirpIgnoreError(codeCachePath) or resolveNlsConfiguration()), the catch block swallows the error with a simple console.error. Because startup() never completes, the process stays alive in an undetermined/corrupted state (zombie process).

We should enforce a fail-fast approach here by adding app.exit(1) inside the catch block so the process is cleanly terminated and signals the failure.

Happy to open a quick PR for this if you agree.

Dominant language
TypeScript
Stars
193k
Forks
42.9k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode

All issues in microsoft/vscode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.