#52815·electron

[Bug]: ElectronMain abort()s in _RegisterApplication when launchservicesd is unreachable (macOS 26)

Author: thiagomsoaresCreated Aug 14, 2026Updated Sep 16, 2026
Labelsplatform/macOSbug :beetle:has-repro-gist43-x-y
### Preflight Checklist - [x] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) for this project. - [x] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project adheres to. - [x] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a bug report that matches the one I want to file, without success. ### Electron Version 43.1.0 ### What operating system(s) are you using? macOS ### Operating System Version macOS 26.6 (25G70) ### What arch are you using? arm64 (including Apple Silicon) ### Last Known Working Electron version Unknown — I have not found a version that does not abort in this environment. ### Does the issue also appear in Chromium / Google Chrome? I don't know how to test ### Expected Behavior Launching Electron on a Mac that cannot register with Launch Services should print an error and exit with a non-zero status. The process should not `abort()`. ### Actual Behavior The process dies immediately (~100–200 ms) with `SIGABRT` / `abort()` before any app JavaScript runs. macOS writes a crash report: ``` abort ___RegisterApplication_block_invoke _RegisterApplication GetCurrentProcess -[NSApplication init] +[NSApplication sharedApplication] ElectronMain ``` Exit code is 134. There is no catchable JS exception. The same launch with `ELECTRON_RUN_AS_NODE=1` does not abort. In a packaged app this produced a crash loop: each retry of the GUI binary died before the app's single-instance lock could run. ### Testcase Gist URL https://gist.github.com/thiagomsoares/1d43024c9d648659766aa581d4dc281e On macOS, from a tree with `[email protected]`: ```bash bash repro.sh # GUI launch: exit 134 # ELECTRON_RUN_AS_NODE control: prints ok, exit 0 ``` Fiddle cannot apply the sandbox; the gist includes `repro.sh`. ### Additional Information Crash report incident `9D39640F-1153-484A-9BB9-9EFCB8DE4F9` (stock `com.github.Electron` 43.1.0). Related but different abort: #51871 (UTF-8 `SIGTRAP`). Older ASN / launchservicesd reports: #16919, #36671. In-depth investigation

`ElectronMain` always creates `NSApplication`. AppKit then calls `_RegisterApplication`. If `launchservicesd` Mach services are unreachable (`com.apple.lsd*`, `com.apple.coreservices.launchservicesd`), HIServices calls `abort()`. Reproduced with `sandbox-exec` denying those names against both stock Electron 43.1.0 and a packaged app. `open -a App` in the same sandbox fails with `_LSOpenURLsWithCompletionHandler error -54` instead of aborting. JS cannot handle this: the abort is inside `ElectronMain` before the isolate exists. Apps can avoid spawning a second GUI process, or launch via Launch Services. They cannot make this fail cleanly. Ask: treat a failed `_RegisterApplication` as a startup error (log + `exit(1)`) instead of letting AppKit `abort()`.