You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Electron: .catch(logger().logError) detaches the method, so logging a rejection throws and masks the original error #18391
WinstonLogger.logError is implemented as this.logErrorAtLevel('error', err) (src/node/desktop/src/core/winston-logger.ts:185-187). When the method is invoked detached from its instance, this is undefined, so the catch handler itself throws:
(node:3872) UnhandledPromiseRejectionWarning: TypeError: Cannot read properties of undefined (reading 'logErrorAtLevel')
at logError (/usr/lib/rstudio/resources/app/.webpack/main/index.js:14:281461)
Two consequences:
The original rejection is masked. Whatever failed (a loadUrl or executeJavaScript rejection) is replaced by this meta-error, so the log never shows the real problem. This made [Electron] Blank window on startup after GPU crash fix (v2026.06.0+242 on Ubuntu 22.04) #18323 harder to diagnose: the reporter's log shows only the logErrorAtLevel TypeError instead of the underlying failure.
The closeEvent path can leave a zombie process. In MainWindow.closeEvent (src/node/desktop/src/main/main-window.ts:342-356), if executeJavaScript('!!window.desktopHooks') rejects (e.g. the renderer already crashed), the throwing catch handler means neither quit() nor this.quitConfirmed = true ever runs, consistent with the process staying alive after the window is gone as observed in [Electron] Blank window on startup after GPU crash fix (v2026.06.0+242 on Ubuntu 22.04) #18323.
Wrap the call so the method is invoked on its instance:
.catch((err)=>logger().logError(err));
Reproduction
Any rejection reaching one of these handlers triggers it. For example, force the main window's renderer to crash (or close the window while the webContents is destroyed) so executeJavaScript rejects in closeEvent; the console shows the logErrorAtLevel TypeError as an unhandled rejection instead of the original error.
Observed in the wild in #18323 (RStudio 2026.06.0+242, Ubuntu 22.04).
Activity
Fix detached logger().logError in desktop promise catch handlers (#18392