From 3ff71f6a0bf5ca992f7801c303e00e8f2cde299d Mon Sep 17 00:00:00 2001 From: webadderall <131426131+webadderall@users.noreply.github.com> Date: Mon, 30 Mar 2026 13:33:49 +1100 Subject: [PATCH] fix(sources): gracefully handle desktopCapturer.getSources failure Catch errors from desktopCapturer.getSources() in the get-sources IPC handler and return an empty array instead of crashing the handler. Prevents repeated 'Failed to get sources' errors when screen recording permission is not granted (common in dev mode on macOS 26). --- electron/ipc/handlers.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.ts index b5f71633..d9cbe35e 100644 --- a/electron/ipc/handlers.ts +++ b/electron/ipc/handlers.ts @@ -2815,6 +2815,9 @@ export function registerIpcHandlers( ? await desktopCapturer.getSources({ ...opts, types: electronTypes, + }).catch((error) => { + console.warn('desktopCapturer.getSources failed (screen recording permission may be missing):', error) + return [] }) : [] const ownWindowNames = new Set(