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

Closed
opened 2026-04-23 13:24:52 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/5810
Author: @matt-fidd
Created: 9/28/2025
Status: Merged
Merged: 9/29/2025
Merged by: @matt-fidd

Base: masterHead: schedule-service-db


📝 Commits (2)

  • 9cb65c7 skip running schedule service if DB not available
  • 3ea8d84 note

📊 Changes

2 files changed (+12 additions, -1 deletions)

View changed files

📝 packages/loot-core/src/server/schedules/app.ts (+6 -1)
upcoming-release-notes/5810.md (+6 -0)

📄 Description

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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/5810 **Author:** [@matt-fidd](https://github.com/matt-fidd) **Created:** 9/28/2025 **Status:** ✅ Merged **Merged:** 9/29/2025 **Merged by:** [@matt-fidd](https://github.com/matt-fidd) **Base:** `master` ← **Head:** `schedule-service-db` --- ### 📝 Commits (2) - [`9cb65c7`](https://github.com/actualbudget/actual/commit/9cb65c76a81b032fca0de6d493211b75d1f7d52c) skip running schedule service if DB not available - [`3ea8d84`](https://github.com/actualbudget/actual/commit/3ea8d8491fd34819b4074e9cc28ae5a07945aeba) note ### 📊 Changes **2 files changed** (+12 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/loot-core/src/server/schedules/app.ts` (+6 -1) ➕ `upcoming-release-notes/5810.md` (+6 -0) </details> ### 📄 Description 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 ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 13:24:52 -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#40567