{"record":{"id":"214bb3afb5cd4dba","repo":"actualbudget/actual","slug":"results-reason-results-error","errorCode":null,"errorMessage":"results.reason || results.error","messagePattern":"results\\.reason \\|\\| results\\.error","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/desktop-client/src/components/banksync/useBuiltInBankSyncProviders.ts","lineNumber":414,"sourceCode":"    }\n\n    if (loadingSimpleFinAccounts) {\n      return;\n    }\n\n    setLoadingSimpleFinAccounts(true);\n\n    try {\n      const results = await send('simplefin-accounts');\n      if (results.error_code === 'INVALID_ACCESS_TOKEN') {\n        onSimpleFinInit();\n        return;\n      }\n      if (results.error_code) {\n        throw new Error(results.reason || results.error_code);\n      }\n      if ('error' in results && results.error) {\n        throw new Error(results.reason || results.error);\n      }\n\n      const externalAccounts: SyncServerSimpleFinAccount[] = (\n        (results.accounts ?? []) as SimpleFinAccount[]\n      ).map(oldAccount => ({\n        account_id: oldAccount.id,\n        name: oldAccount.name,\n        institution: oldAccount.org.name,\n        orgDomain: oldAccount.org.domain,\n        orgId: oldAccount.org.id,\n        balance: oldAccount.balance,\n      }));\n\n      dispatch(\n        pushModal({\n          modal: {\n            name: 'select-linked-accounts',\n            options: {","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/actualbudget/actual/blob/d4334cb6e6123f4d3bcea1ad6166608884c7e658/packages/desktop-client/src/components/banksync/useBuiltInBankSyncProviders.ts#L396-L432","documentation":"Companion guard to the error_code check: if the 'simplefin-accounts' response contains an 'error' field (generic server/provider error without a structured code), it is thrown as an Error using results.reason or results.error as the message.","triggerScenarios":"The 'simplefin-accounts' IPC returns an object with error_code falsy but { error: '...' } present — typically an unstructured failure on the sync server when proxying SimpleFin (HTTP error body, exception message, etc.).","commonSituations":"SimpleFin bridge returning 5xx pages that get surfaced as an error string; sync-server misconfiguration; transient network failure between the server and SimpleFin.","solutions":["Inspect the thrown message (results.reason || results.error) and the sync-server logs for the underlying HTTP failure","Retry the fetch after confirming the SimpleFin bridge is reachable from the sync server","Verify SIMPLEFIN_BASE_URL points at a valid bridge endpoint","Update Actual/sync-server if the provider API contract changed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const res = await send('simplefin-accounts');\nif (('error' in res && res.error) || res.error_code) {\n  throw new Error(res.reason || (res as { error?: string }).error || res.error_code);\n}","typeGuard":"const hasProviderError = (r: object): r is { reason?: string; error: string } =>\n  'error' in r && typeof (r as { error?: unknown }).error === 'string' && r.error !== '';","tryCatchPattern":"try {\n  await loadSimpleFinAccounts();\n} catch (e) {\n  logger.error('SimpleFin error', e);\n  notify('SimpleFin fetch failed; check sync-server logs.');\n}","preventionTips":["Monitor sync-server connectivity to the SimpleFin bridge","Retry transient failures with backoff","Keep the SIMPLEFIN_BASE_URL configuration validated"],"tags":["banksync","simplefin","network","api-error"],"backgroundTag":"bank-sync-provider-error","analyzedSha":"d4334cb6e6123f4d3bcea1ad6166608884c7e658","analyzedAt":"2026-08-29T01:02:11.213Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}