[PR #5810] skip running the schedule service if the database is not loaded #20499

Closed
opened 2026-04-14 21:38:56 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/actualbudget/actual/pull/5810

State: closed
Merged: Yes


Prevents this nuisance error, which occurs roughly every 100 runs of the API. It's obviously some form of race but it's certainly not common, probably an edge case where the sync event finishes, runs the schedules service, and it doesn't finish before the sync is done and the db is closed. It'll just be run at the next chance so there's no issue skipping it - besides it would just fail otherwise.

/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:5534
        stmt = typeof sql === "string" ? db2.prepare(sql) : sql;
                                             ^
TypeError: Cannot read properties of null (reading 'prepare')
    at runQuery$1 (/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:5534:46)
    at runQuery (/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:60261:16)
    at all (/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:60290:12)
    at execQuery$1 (/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:14096:24)
    at runCompiledAqlQuery (/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:14113:22)
    at compileAndRunAqlQuery (/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:14129:24)
    at aqlQuery (/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:14702:12)
    at advanceSchedulesService (/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:79315:39)
    at /data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:79365:30
    at _runMutator (/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:55808:12)

Node.js v22.17.0
**Original Pull Request:** https://github.com/actualbudget/actual/pull/5810 **State:** closed **Merged:** Yes --- Prevents this nuisance error, which occurs roughly every 100 runs of the API. It's obviously some form of race but it's certainly not common, probably an edge case where the sync event finishes, runs the schedules service, and it doesn't finish before the sync is done and the db is closed. It'll just be run at the next chance so there's no issue skipping it - besides it would just fail otherwise. ``` /data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:5534 stmt = typeof sql === "string" ? db2.prepare(sql) : sql; ^ TypeError: Cannot read properties of null (reading 'prepare') at runQuery$1 (/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:5534:46) at runQuery (/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:60261:16) at all (/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:60290:12) at execQuery$1 (/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:14096:24) at runCompiledAqlQuery (/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:14113:22) at compileAndRunAqlQuery (/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:14129:24) at aqlQuery (/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:14702:12) at advanceSchedulesService (/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:79315:39) at /data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:79365:30 at _runMutator (/data/actual/node_modules/@actual-app/api/dist/app/bundle.api.js:55808:12) Node.js v22.17.0 ```
GiteaMirror added the pull-request label 2026-04-14 21:38:56 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#20499