When I open a .ino
file, the empty sketch window opens, and almost the all operations in the IDE menu (except Quit Arduino IDE
) would cause the following:
It says:
A JavaScript error occurred in the main process
Uncaught Exception:
TypeError: Object has been destroyed
at _.send (node:electron/js2c/browser_init:2:73448)
at t.nodeId.r.click (/Applications/Arduino IDE.app/Contents/Resources/app/lib/backend/electron-main.js:5:29489)
at MenuItem.click (node:electron/js2c/browser_init:2:33700)
at a._executeCommand (node:electron/js2c/browser_init:2:39128)
I found the same issue but it had not been resolved:
Hi @tazvivona . I'm going to ask you to post some additional information that might help us to identify the problem.
Please do this:
Start Windows "File Explorer".
Open the Arduino IDE installation folder.
(usually C:\Program Files\Arduino IDE or C:\Users\<user name>\AppData\Local\Programs\Arduino IDE).
In the folder listing of the Arduino IDE installation folder, hold the Shift key while clicking the right hand button on the mouse.
From the context menu, click "Open PowerShell window here".
β¦
My environment
MacBook Pro (Intel Mac) / MacOS 11.7.10οΌBig Sur)
Arduino IDE 2.3.5
I've done the following but it doesn't fix the issue.
Remove the following folders base on this document
/Users/{username}/Library/Arduino15
/Users/{username}/.arduinoIDE
Uninstall Arduino IDE and re-install.
How can I fix this issue?
Thanks in advance.
Hi @embeddedkiddie .
embeddedkiddie:
When I open a .ino
file
I'm not sure I understood correctly what you mean by this. Please provide detailed step-by-step instructions I could follow to reproduce the problem on my computer.
Hi @ptillisch ,
Thank you for your replying.
There are many projects in my sketch folder. For example:
Arduino/SD_Test
βββ SD_Test.ino
When I double click SD_Test.ino
, two windows opens. One is for SD_Test.ino
, and the other is blank window which I attached in post #1 .
However, if I open the IDE directly from the Applications folder without specifying any .ino
file, it will only open the last sketch I opened.
Does what I'm saying make sense?
Thanks.
Hi @ptillisch ,
My memory is hazy so it may be difficult to reproduce the problem, but I will try.
I opened some .ino
file, e.g. SD_Test.ino
for example in post #3 . At this time the ESP32 board package was 3.1.3.
I opened another .ino
file to test something. I re-install the board package 2.0.17, then compiled & uploaded.
During I was switching between 2.0.17 and 3.1.3 several times to test something, the IDE hung up. I couldn't quit from the IDE menu or "x" button on the top left of the sketch window, so I forced the Arduino IDE to quit with "option + command + ESC".
I reboot my Mac just to be sure.
The issue started happening after a reboot.
I also removed all the cache files in /Users/{username}/Library/Caches/arduino/sketches/
, but the issue is still here.
Is it possible that a terminated process is still somewhere?
Or do you have any idea?
Thank you!
pert
Split this topic
April 6, 2025, 5:02am
6
3 posts were split to a new topic: IDE restarts while compiling sketch
Thanks. This information allowed me to reproduce the fault. I submitted a formal bug report to the Arduino IDE developers on your behalf:
opened 07:53PM - 04 Apr 25 UTC
type: imperfection
topic: theia
### Describe the problem
In addition to starting the Arduino IDE application di⦠rectly, it can be started by opening a specific sketch file when sketches are associated with the Arduino IDE application.
π When Arduino IDE is started by opening a sketch file, an additional blank window is opened. This is annoying to the users and might cause confusion.
### To reproduce
1. If Arduino IDE is running, select **Arduino IDE > Quit Arduino IDE** from the Arduino IDE menus.
All Arduino IDE windows will close.
1. [Control-click](https://support.apple.com/en-ca/guide/mac-help/mh35853/mac#mchlpd024d02) on any `.ino` file from a sketch.
A context menu will open.
1. Select "**Open With**" from the menu.
A submenu will open that allows you to select which application to use to open the file.
1. Select the Arduino IDE application from the menu.
Arduino IDE starts, with the selected sketch open as expected.
π However, an additional blank Arduino window also opens.
### Expected behavior
Blank Arduino windows are not created.
### Arduino IDE version
e36f393
### Operating system
macOS
### Operating system version
Sequoia
### Additional context
I bisected the regression to 859d29d41af2146537abedb42c9798011b452983 / https://github.com/arduino/arduino-ide/pull/2654 (does not occur when using the build at the previous commit d298b3ffc94008e89066cd999d891e84190da18f).
---
Since this fault is similar to the one reported in https://github.com/arduino/arduino-ide/issues/2678, I hoped this would also be fixed by https://github.com/arduino/arduino-ide/pull/2686. However, the fault still occurs when using the tester build from that PR (e62764b8d8957d6e37022e8833ce84afd5172d28).
---
The fault does not occur when I start Arduino IDE by passing the path of the sketch via a command line argument.
---
I see this in the logs when the fault occurs:
```text
2025-04-04 12:27:30 (node:24650) UnhandledPromiseRejectionWarning: Error: Received 'open-file' event. Interrupting the default launch workflow.
at App.<anonymous> (/Applications/arduino-tools/2.x/268-e36f393.app/Contents/Resources/app/lib/backend/electron-main.js:2:1218999)
```
---
The original reporter sees a dialog when the fault occurs:

```text
A JavaScript error occurred in the main process
Uncaught Exception:
TypeError: Object has been destroyed
at _.send (node:electron/js2c/browser_init:2:73448)
at t.nodeId.r.click (/Applications/Arduino IDE.app/Contents/Resources/app/lib/backend/electron-main.js:5:29489)
at MenuItem.click (node:electron/js2c/browser_init:2:33700)
at a._executeCommand (node:electron/js2c/browser_init:2:39128)
```
Although I do encounter the blank window fault, I don't get that dialog.
---
Originally reported by @embedded-kiddie at https://forum.arduino.cc/t/a-javascript-error-occurred-in-the-main-process-when-i-open-some-ino-file/1370279
### Issue checklist
- [x] I searched for previous reports in [the issue tracker](https://github.com/arduino/arduino-ide/issues?q=)
- [x] I verified the problem still occurs when using the latest [nightly build](https://www.arduino.cc/en/software#nightly-builds)
- [x] My report contains all necessary details
Thanks for bringing this to our attention!
You can subscribe to that thread to get notifications of any new developments related to this subject:
Please only comment on the GitHub issue thread if you have new technical information that will assist with the resolution. General discussion and support requests are always welcome here on the Arduino Forum.
I think that was a different problem, which just happened to also produce one of those "A JavaScript error occurred in the main process " dialogs.
For now, I recommend starting the Arduino IDE application directly, rather than by opening a sketch. Once Arduino IDE is running, you can then open sketches without encountering the problem.
Alternatively, if you do want to start Arduino IDE by opening a sketch, it should be possible to simply close that extra blank window. From my experiments, Arduino IDE is completely functional under these conditions, so the bug is an annoyance (and source of potential confusion for users who first encounter it) rather than a show stopper.
Hi @ptillisch ,
Thank you for your support and also creating the issue on GitHub. I subscribe it.
I reverted the IDE version from 2.3.5 to 2.3.4 and the issue disappeared.
Another problem with 2.3.5 is that if there is a sketch being compiling, it is always brought to the foreground, so I cannot edit other open sketches.
This is very annoying and gets in the way of coding.
Hi @yudilubis .
This bug has already been fixed, but the fix was made after the time of the 2.3.5 release. Until the 2.3.6 release comes out, the fix will only be available when using the nightly build of Arduino IDE. If you like, you can get the nightly build from the download links here:
https://www.arduino.cc/en/software#nightly-builds
As I mentioned above, the bug with opening additional sketches has already been reported and resolved.
As for the "Sketches that previously worked on versβ¦
So I'd skip 2.3.5.
The bug has been reported here:
opened 05:10AM - 03 Apr 25 UTC
closed 03:51PM - 03 Apr 25 UTC
conclusion: resolved
topic: code
type: imperfection
topic: theia
### Describe the problem
Arduino IDE displays various information in the "**Out⦠put**" view.
During long operations such as installing large boards platforms or libraries, or compiling/uploading large sketch programs, the user may wish to multitask by using another application will the operation proceeds in Arduino IDE.
π The Arduino IDE window [steals focus](https://blog.codinghorror.com/please-dont-steal-my-focus/) from the other application each time any new content is printed to the "**Output**" view. This makes it impossible for the user to multitask.
### To reproduce
#### Linux and macOS
1. Open Library Manager.
1. Type `arduinoiotcloud` in the "**Filter your search...**" field.
1. If the "**ArduinoIoTCloud**" library is already installed, use Library Manager to uninstall it.
1. Click the "**INSTALL**" button on the "**ArduinoIoTCloud**" library entry.
**β** Installation of the "**ArduinoIoTCloud**" library was chosen arbitrarily as a simple operation that will produce periodic output. The bug is not in any way specific to this particular operation.
An "**Install library dependencies**" dialog will open.
1. Click the "**INSTALL ALL**" button in the "**Install library dependencies**" dialog.
The dialog will close and installation of the libraries will start.
1. Switch to any other application's window.
π The Arduino IDE window will automatically take focus from the other application each time a message indicating the libraries installation progress is printed in the "**Output**" panel.
#### Windows
From my tests, the situation is different for Windows users in that focus is only stolen from other Arduino IDE windows.
1. Start Arduino IDE.
1. Select **File > New Sketch** from the Arduino IDE menus.
An additional Arduino IDE will open.
1. Open Library Manager.
1. Type `arduinoiotcloud` in the "**Filter your search...**" field.
1. If the "**ArduinoIoTCloud**" library is already installed, use Library Manager to uninstall it.
1. Click the "**INSTALL**" button on the "**ArduinoIoTCloud**" library entry.
An "**Install library dependencies**" dialog will open.
1. Click the "**INSTALL ALL**" button in the "**Install library dependencies**" dialog.
The dialog will close and installation of the libraries will start.
1. Switch to the other Arduino IDE window.
π The Arduino IDE window in which the library installation was performed will automatically take focus from the current Arduino IDE window each time a message indicating the libraries installation progress is printed in the "**Output**" panel.
### Expected behavior
Arduino IDE does not steal focus from other windows.
### Arduino IDE version
2.3.5
### Operating system
- Linux
- macOS
- Windows
### Operating system version
- Ubuntu 24.04
- macOS Sequoia
- Windows 11
### Additional context
I bisected the regression to 859d29d41af2146537abedb42c9798011b452983 / https://github.com/arduino/arduino-ide/pull/2654 (does not occur when using the build at the previous commit d298b3ffc94008e89066cd999d891e84190da18f).
---
I was not able to reproduce the fault using [**Eclipse Theia IDE**](https://theia-ide.org/#theiaide) version 1.57.0.
---
The fault does not occur when text is printed in the "**Terminal**" view instead of the "**Output**" view.
---
Originally reported by @Gartosz at https://github.com/arduino/arduino-ide/issues/2678#issuecomment-2773660384
### Issue checklist
- [x] I searched for previous reports in [the issue tracker](https://github.com/arduino/arduino-ide/issues?q=)
- [x] I verified the problem still occurs when using the latest [nightly build](https://www.arduino.cc/en/software#nightly-builds)
- [x] My report contains all necessary details
and already fixed last week:
main
β fix-window-focus
opened 03:19PM - 03 Apr 25 UTC
### Motivation
Resolves https://github.com/arduino/arduino-ide/issues/2679
β¦
### Change description
Prevent `ApplicationShell` to set main window focus if revealed widget is `OutputWidget`
### Other information
Although I wasn't able to reproduce the issue in Theia IDE Desktop v1.57.0, seems that the problem might be caused by a regression or an expected change in behaviour in Theia. To deal with the secondary window, Theia might prioritize the main one when `OutputWidget` is refreshed (see https://github.com/eclipse-theia/theia/pull/13493)
An issue will follow on Theia side after a deeper analysis or anything new is found.
The blank window bug you reported here has also been fixed:
main
β fix-macos-empty-window
opened 08:22AM - 07 Apr 25 UTC
### Motivation
Resolves https://github.com/arduino/arduino-ide/issues/2688
β¦
### Change description
Theia internally create an initial empty window on app start to improve UX while first loading the app instance, see https://github.com/eclipse-theia/theia/pull/12897
On MacOS, since open sketch via file association was triggered before initial window reference was set, the open sketch logic would create a new window instance instead of reusing the early created window reference, leaving an unresponsive additional empty window.
The `open-file` event is triggered before the app is ready and `initialWindow` is created, leading to `openSketch`
to create a new window instead of reusing the `initialWindow`.
Currently there is no ideal way to wait or react to `initialWindow` value change, so we pool on the value.
Note that this only needed on the first window startup as on other instances, `showWindowEarly` is not used `initialWindow` is null.
The pool set a generous amount of retries but should bail consistently on the first try as `initialWindow` is set right after the app is ready. Note that in case the pools timeout, we open the sketch on a new window anyway.
Thank you for your feedback.
I'm looking forward to 2.3.6
1 Like