{"record":{"id":"8027e86c4797ee26","repo":"actualbudget/actual","slug":"applyappupdate-not-implemented-in-electron-app","errorCode":null,"errorMessage":"applyAppUpdate not implemented in electron app","messagePattern":"applyAppUpdate not implemented in electron app","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/desktop-electron/preload.ts","lineNumber":109,"sourceCode":"  },\n\n  moveBudgetDirectory: (\n    currentBudgetDirectory: string,\n    newDirectory: string,\n  ) => {\n    return ipcRenderer.invoke(\n      'move-budget-directory',\n      currentBudgetDirectory,\n      newDirectory,\n    );\n  },\n\n  reload: async () => {\n    throw new Error('Reload not implemented in electron app');\n  },\n\n  applyAppUpdate: async () => {\n    throw new Error('applyAppUpdate not implemented in electron app');\n  },\n} satisfies typeof global.Actual);\n","sourceCodeStart":91,"sourceCodeEnd":112,"githubUrl":"https://github.com/actualbudget/actual/blob/d4334cb6e6123f4d3bcea1ad6166608884c7e658/packages/desktop-electron/preload.ts#L91-L112","documentation":"The Electron preload bridge deliberately throws for `reload` and `applyAppUpdate` instead of providing implementations. `applyAppUpdate` exists on the browser `window.Actual` API to apply a pending service-worker update; the Electron desktop app updates itself through its own updater, so this stub signals that the browser-only method was called in the wrong environment.","triggerScenarios":"Calling `window.Actual.applyAppUpdate()` (or code in desktop-client that invokes it, e.g. the 'update available' toast flow) while running in the Electron app, because the code assumed the browser `global.Actual` API surface.","commonSituations":"Shared client code written for the web build being reused in the desktop build; a release-flow UI component rendering in Electron; a plugin or custom patch calling the API without checking the platform.","solutions":["Skip the update-apply UI flow when running under Electron (check for Electron environment before offering 'apply update')","In Electron, let the app auto-update via the Electron updater path instead of calling applyAppUpdate","If you truly need a no-op, wrap the call in try/catch and treat the throw as 'handled natively by desktop'"],"exampleFix":"// before\nawait window.Actual.applyAppUpdate();\n// after\nif (process.env.IS_ELECTRON) {\n  // Electron applies updates itself; nothing to do\n} else {\n  await window.Actual.applyAppUpdate();\n}","handlingStrategy":"try-catch","validationCode":"const isElectron = typeof process !== 'undefined' && process.env.IS_ELECTRON;\nif (isElectron) throw new Error('applyAppUpdate unsupported in Electron');","typeGuard":"const supportsApplyUpdate = (a: unknown): a is { applyAppUpdate: () => Promise<void> } =>\n  typeof a === 'object' && a !== null && 'applyAppUpdate' in a;","tryCatchPattern":"try {\n  await window.Actual.applyAppUpdate();\n} catch (e) {\n  if (String(e).includes('applyAppUpdate not implemented')) {\n    // Electron handles updates natively; ignore\n  } else throw e;\n}","preventionTips":["Branch update UI on platform (Electron vs browser) before calling the API","Treat the browser-only methods of global.Actual as unavailable in the desktop build","Cover release/update flows with e2e tests in both web and desktop targets"],"tags":["electron","environment","api-not-implemented"],"backgroundTag":"api-not-supported-on-platform","analyzedSha":"d4334cb6e6123f4d3bcea1ad6166608884c7e658","analyzedAt":"2026-08-29T01:02:11.213Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}