Other ERR_JS_MAINMedium

A JavaScript error occurred in the main process: quick fix

This error commonly appears in Electron-based apps due to cache corruption or driver conflicts. Learn how to quickly restore program functionality, clear configurations, and update components.

Updated at April 2, 2026
10-15 min
Easy
FixPedia Team
Применимо к:Electron apps (Discord, VS Code, Slack, OBS)Windows 10/11macOS 12+Ubuntu/Debian 20.04+

What the ERR_JS_MAIN Error Means

The message "A JavaScript error occurred in the main process" appears when launching programs built on the Electron framework (Discord, Visual Studio Code, OBS Studio, Slack, Notion, and others). It means that the application's background process (the main Node.js thread) encountered a critical error before the user interface was rendered.

Typically, the system displays a standard OS dialog with the full exception text and stack trace. The application freezes, becomes unresponsive to clicks, or closes immediately after the icon appears in the system tray.

Causes

  • Corrupted local cache. Files like index.ldb, Local Storage, or session can be written with errors due to sudden power loss, cloud disk synchronization, or forced process termination.
  • Graphics card driver conflict. Electron heavily uses the GPU for hardware acceleration. Outdated or unstable drivers cause a failure in initializing the rendering window.
  • Missing system libraries. On Linux distributions, the error occurs if base packages like libnss3, libatk1.0-0, or libgbm1 are not installed.
  • Antivirus blockage. Security software may mistakenly flag the application's built-in JS scripts as suspicious and block their execution in memory.
  • Version incompatibility. After a major OS update or profile migration, old configuration files can conflict with the architecture of a new Electron release.

Solutions

Solution 1: Full Process Reset and Restart

Sometimes the background process remains "stuck" in memory, preventing a new instance of the program from launching correctly.

  1. Open the Task Manager (Ctrl + Shift + Esc on Windows or System Monitor on Linux/macOS).
  2. Go to the "Details" or "Processes" tab.
  3. Find all processes with the application's name (e.g., discord.exe, code, slack).
  4. Select each one and click "End Task".
  5. Launch the program again.

💡 Tip: If the error window appears instantly, try launching the application with the GPU disable flag. In the Windows shortcut properties, add --disable-gpu to the end of the "Target" field (ensure there is a space before the dashes). For macOS/Linux, use the terminal: ./app --disable-gpu.

Solution 2: Clearing Corrupted Cache and Settings

The most effective method. We will delete only local configuration files, preserving account data stored on the developer's servers.

  1. Completely close the application (check the Task Manager).
  2. Open your file manager and navigate to the settings directory:
    • Windows: Press Win + R, type %appdata% and %localappdata%
    • macOS: In Finder, press Cmd + Shift + G, type ~/Library/Application Support/
    • Linux: Open a terminal and navigate to ~/.config/
  3. Find the folder named after the application (e.g., Discord, Code, slack).
  4. Rename it by adding a .old suffix (e.g., Discord.old).
  5. Launch the program. It will automatically create a fresh settings folder with default values.

Solution 3: Updating the Environment and Checking Dependencies

If the problem occurs after a system update or migration to a new device, ensure all components are up-to-date and compatible.

  1. Go to the application's official website and download the latest stable build. Install it over your current installation.
  2. Update your graphics card drivers via the manufacturer's official portal (NVIDIA, AMD, Intel).
  3. For Linux users: Run the following in a terminal to install missing libraries. Example for Debian/Ubuntu:
# Update package lists
sudo apt update
# Install dependencies for rendering and networking stack
sudo apt install -y libnss3 libatk-bridge2.0-0 libdrm2 libgbm1 libasound2 libx11-xcb1
  1. Restart your computer and try launching the application again.

Solution 4: Force-Disable Hardware Acceleration via Config

If updating drivers is not possible, you can disable GPU rendering at the configuration file level.

  1. Open the application's configuration folder (as in Solution 2).
  2. Find the config.json or settings.json file in the root directory. If the file does not exist, create it manually.
  3. Add or modify the following parameter:
{
  "disableHardwareAcceleration": true
}
  1. Save the changes and launch the program. The interface may run slightly slower, but the critical error should disappear.

Prevention

To avoid a repeat of this failure, follow these simple maintenance rules for Electron applications:

  • Install updates regularly. Developers patch vulnerabilities and adapt code for new OS and browser engine versions.
  • Do not shut down your computer while the program is running, especially during background updates or data synchronization.
  • Add important programs to your antivirus and firewall exceptions to prevent accidental blocking of legitimate JS scripts.
  • Monitor free space on your system drive. Lack of space leads to corruption of cache files, logs, and temporary data.
  • Make backups of your configuration folders (AppData or ~/.config) before major system updates or clean OS installations.

F.A.Q.

Why does this error only appear in one specific app?
Can I just reinstall the app to fix the error?
Is it safe to disable hardware acceleration in Electron?

Hints

Terminate background processes
Clear configuration folder
Launch with GPU disable flag
Update app and drivers

Did this article help you solve the problem?

FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community