[Bug]: Crash at launch due to database schema mismatch #1661

Closed
opened 2026-02-28 19:50:08 -06:00 by GiteaMirror · 10 comments
Owner

Originally created by @omnizach on GitHub (Dec 10, 2024).

Verified issue does not already exist?

  • I have searched and found no existing issue
  • I will be providing steps how to reproduce the bug (in most cases this will also mean uploading a demo budget file)

What happened?

Using the Docker and the latest release (24.12.0), the container crashes when starting. The error in the log is:

Checking if there are any migrations to run for direction "up"...

/app/node_modules/better-sqlite3/lib/methods/wrappers.js:9
        this[cppdb].exec(sql);
                    ^
SqliteError: no such column: password
    at Database.exec (/app/node_modules/better-sqlite3/lib/methods/wrappers.js:9:14)
    at WrappedDatabase.exec (file:///app/src/db.js:30:20)
    at Migration.up (file:///app/migrations/1718889148000-openid.js:4:24)
    at next (/app/node_modules/migrate/lib/migrate.js:35:45)
    at /app/node_modules/migrate/lib/migrate.js:71:9
    at /app/node_modules/migrate/lib/set.js:84:5
    at FSReqCallback.oncomplete (node:fs:192:23) {
  code: 'SQLITE_ERROR'
}

Node.js v18.20.5

Confusingly, there is no migration named 1718889148000-openid that I could find, so I can't get any further in debugging this.

I attempted to downgrade back to 24.11.0, but this broke the client due to the server version being ahead of the client. So, I'm stuck with a non-working deployment.

Where are you hosting Actual?

Docker

What browsers are you seeing the problem on?

Firefox

Operating System

Windows 11

Originally created by @omnizach on GitHub (Dec 10, 2024). ### Verified issue does not already exist? - [X] I have searched and found no existing issue - [X] I will be providing steps how to reproduce the bug (in most cases this will also mean uploading a demo budget file) ### What happened? Using the Docker and the `latest` release (24.12.0), the container crashes when starting. The error in the log is: ``` Checking if there are any migrations to run for direction "up"... /app/node_modules/better-sqlite3/lib/methods/wrappers.js:9 this[cppdb].exec(sql); ^ SqliteError: no such column: password at Database.exec (/app/node_modules/better-sqlite3/lib/methods/wrappers.js:9:14) at WrappedDatabase.exec (file:///app/src/db.js:30:20) at Migration.up (file:///app/migrations/1718889148000-openid.js:4:24) at next (/app/node_modules/migrate/lib/migrate.js:35:45) at /app/node_modules/migrate/lib/migrate.js:71:9 at /app/node_modules/migrate/lib/set.js:84:5 at FSReqCallback.oncomplete (node:fs:192:23) { code: 'SQLITE_ERROR' } Node.js v18.20.5 ``` Confusingly, there is no migration named 1718889148000-openid that I could find, so I can't get any further in debugging this. I attempted to downgrade back to 24.11.0, but this broke the client due to the server version being ahead of the client. So, I'm stuck with a non-working deployment. ### Where are you hosting Actual? Docker ### What browsers are you seeing the problem on? Firefox ### Operating System Windows 11
GiteaMirror added the bug label 2026-02-28 19:50:08 -06:00
Author
Owner

@matt-fidd commented on GitHub (Dec 10, 2024):

There are some instructions on how to resolve this on the Discord, you can join with this link: https://discord.gg/FnHPqj8j and the thread is https://discord.com/channels/937901803608096828/1310791130492702740

@matt-fidd commented on GitHub (Dec 10, 2024): There are some instructions on how to resolve this on the Discord, you can join with this link: https://discord.gg/FnHPqj8j and the thread is https://discord.com/channels/937901803608096828/1310791130492702740
Author
Owner

@alekstnr commented on GitHub (Dec 30, 2024):

Adding some info for those that do not want to use discord:

The problem seems to be caused by migrations getting rerun, when they should not be (they have already been done). This happens due to actual not seeing the .migrations file that lives in the /data folder in the container.

In my case, I had just migrated my actual instance to a new server, and the permissions on the .migrations file were wrong, so it tried to do the migrations again and could not, because the password column did not exist.

my fix involved making sure that the .migrations file was identical between both servers and making sure the permissions were right. Then my actual launched fine.

If I may suggest, the migrations should be idempotent, so they can be rerun regardless of if the db has already been through them, and they will not error. they will just make sure it is in the expected state, and exit cleanly if that is already the case.
Thanks

@alekstnr commented on GitHub (Dec 30, 2024): Adding some info for those that do not want to use discord: The problem seems to be caused by migrations getting rerun, when they should not be (they have already been done). This happens due to actual not seeing the .migrations file that lives in the /data folder in the container. In my case, I had just migrated my actual instance to a new server, and the permissions on the .migrations file were wrong, so it tried to do the migrations again and could not, because the password column did not exist. my fix involved making sure that the .migrations file was identical between both servers and making sure the permissions were right. Then my actual launched fine. If I may suggest, the migrations should be idempotent, so they can be rerun regardless of if the db has already been through them, and they will not error. they will just make sure it is in the expected state, and exit cleanly if that is already the case. Thanks
Author
Owner

@ahal commented on GitHub (Jan 1, 2025):

If you're using Unraid, this bug stems from a misconfiguration in the template found in Community Apps. To resolve the issue:

  1. Delete the existing server-files and user-files paths

  2. Add a new Path variable with:
    Container Path: /data
    Host Path: path/to/appdata/actualserver

  3. Start up the container (it will still crash)

  4. Edit path/to/appdata/actualserver/.migrate

There are two migrations at the bottom with timestamp of null. Replace null with the following timestamps respectively:

  • 1732656575219
  • 1732656575220
  1. Restart the container (it should work this time)
@ahal commented on GitHub (Jan 1, 2025): If you're using Unraid, this bug stems from a misconfiguration in the template found in Community Apps. To resolve the issue: 1. Delete the existing `server-files` and `user-files` paths 2. Add a new Path variable with: Container Path: /data Host Path: path/to/appdata/actualserver 3. Start up the container (it will still crash) 4. Edit `path/to/appdata/actualserver/.migrate` There are two migrations at the bottom with timestamp of `null`. Replace `null` with the following timestamps respectively: * 1732656575219 * 1732656575220 5. Restart the container (it should work this time)
Author
Owner

@clayauld commented on GitHub (Jan 8, 2025):

Confirm this fix works for UnRAID

@clayauld commented on GitHub (Jan 8, 2025): Confirm this fix works for UnRAID
Author
Owner

@WheatlyInc commented on GitHub (Jan 17, 2025):

Just wanted to chime in this fixed the same issue for me on my Unraid instance! Was worried it was the result of a storage upgrade. Thanks

@WheatlyInc commented on GitHub (Jan 17, 2025): Just wanted to chime in this fixed the same issue for me on my Unraid instance! Was worried it was the result of a storage upgrade. Thanks
Author
Owner

@motoridersd commented on GitHub (Apr 9, 2025):

I'm having a similar issue with the Proxmox Helper Script after updating from 25.3.1 to 25.4.0. Migrations are failing:

Apr 09 08:01:47 actualbudget systemd[1]: actualbudget.service: Consumed 3.563s CPU time.
Apr 09 08:01:47 actualbudget systemd[1]: Started actualbudget.service - Actual Budget Service.
Apr 09 08:01:49 actualbudget yarn[1192]: Checking if there are any migrations to run for direction "up"...
Apr 09 08:01:49 actualbudget yarn[1192]: /opt/actualbudget/node_modules/better-sqlite3/lib/methods/wrappers.js:9
Apr 09 08:01:49 actualbudget yarn[1192]:         this[cppdb].exec(sql);
Apr 09 08:01:49 actualbudget yarn[1192]:                     ^
Apr 09 08:01:49 actualbudget yarn[1192]: SqliteError: no such column: password
Apr 09 08:01:49 actualbudget yarn[1192]:     at Database.exec (/opt/actualbudget/node_modules/better-sqlite3/lib/methods>
Apr 09 08:01:49 actualbudget yarn[1192]:     at WrappedDatabase.exec (file:///opt/actualbudget/packages/sync-server/src/>
Apr 09 08:01:49 actualbudget yarn[1192]:     at Migration.up (file:///opt/actualbudget/packages/sync-server/migrations/1>
Apr 09 08:01:49 actualbudget yarn[1192]:     at next (/opt/actualbudget/node_modules/migrate/lib/migrate.js:35:45)
Apr 09 08:01:49 actualbudget yarn[1192]:     at migrate (/opt/actualbudget/node_modules/migrate/lib/migrate.js:76:3)
Apr 09 08:01:49 actualbudget yarn[1192]:     at MigrationSet.migrate (/opt/actualbudget/node_modules/migrate/lib/set.js:>
Apr 09 08:01:49 actualbudget yarn[1192]:     at MigrationSet.up (/opt/actualbudget/node_modules/migrate/lib/set.js:107:8)
Apr 09 08:01:49 actualbudget yarn[1192]:     at file:///opt/actualbudget/packages/sync-server/src/migrations.js:25:23
Apr 09 08:01:49 actualbudget yarn[1192]:     at /opt/actualbudget/node_modules/migrate/index.js:62:5
Apr 09 08:01:49 actualbudget yarn[1192]:     at /opt/actualbudget/node_modules/migrate/lib/load-migrations.js:97:7 {
Apr 09 08:01:49 actualbudget yarn[1192]:   code: 'SQLITE_ERROR'
Apr 09 08:01:49 actualbudget yarn[1192]: }
Apr 09 08:01:49 actualbudget yarn[1192]: Node.js v20.19.0
Apr 09 08:01:49 actualbudget systemd[1]: actualbudget.service: Main process exited, code=exited, status=1/FAILURE
Apr 09 08:01:49 actualbudget systemd[1]: actualbudget.service: Failed with result 'exit-code'.
Apr 09 08:01:49 actualbudget systemd[1]: actualbudget.service: Consumed 2.956s CPU time.```
@motoridersd commented on GitHub (Apr 9, 2025): I'm having a similar issue with the Proxmox Helper Script after updating from 25.3.1 to 25.4.0. Migrations are failing: ```Apr 09 08:01:47 actualbudget systemd[1]: Stopped actualbudget.service - Actual Budget Service. Apr 09 08:01:47 actualbudget systemd[1]: actualbudget.service: Consumed 3.563s CPU time. Apr 09 08:01:47 actualbudget systemd[1]: Started actualbudget.service - Actual Budget Service. Apr 09 08:01:49 actualbudget yarn[1192]: Checking if there are any migrations to run for direction "up"... Apr 09 08:01:49 actualbudget yarn[1192]: /opt/actualbudget/node_modules/better-sqlite3/lib/methods/wrappers.js:9 Apr 09 08:01:49 actualbudget yarn[1192]: this[cppdb].exec(sql); Apr 09 08:01:49 actualbudget yarn[1192]: ^ Apr 09 08:01:49 actualbudget yarn[1192]: SqliteError: no such column: password Apr 09 08:01:49 actualbudget yarn[1192]: at Database.exec (/opt/actualbudget/node_modules/better-sqlite3/lib/methods> Apr 09 08:01:49 actualbudget yarn[1192]: at WrappedDatabase.exec (file:///opt/actualbudget/packages/sync-server/src/> Apr 09 08:01:49 actualbudget yarn[1192]: at Migration.up (file:///opt/actualbudget/packages/sync-server/migrations/1> Apr 09 08:01:49 actualbudget yarn[1192]: at next (/opt/actualbudget/node_modules/migrate/lib/migrate.js:35:45) Apr 09 08:01:49 actualbudget yarn[1192]: at migrate (/opt/actualbudget/node_modules/migrate/lib/migrate.js:76:3) Apr 09 08:01:49 actualbudget yarn[1192]: at MigrationSet.migrate (/opt/actualbudget/node_modules/migrate/lib/set.js:> Apr 09 08:01:49 actualbudget yarn[1192]: at MigrationSet.up (/opt/actualbudget/node_modules/migrate/lib/set.js:107:8) Apr 09 08:01:49 actualbudget yarn[1192]: at file:///opt/actualbudget/packages/sync-server/src/migrations.js:25:23 Apr 09 08:01:49 actualbudget yarn[1192]: at /opt/actualbudget/node_modules/migrate/index.js:62:5 Apr 09 08:01:49 actualbudget yarn[1192]: at /opt/actualbudget/node_modules/migrate/lib/load-migrations.js:97:7 { Apr 09 08:01:49 actualbudget yarn[1192]: code: 'SQLITE_ERROR' Apr 09 08:01:49 actualbudget yarn[1192]: } Apr 09 08:01:49 actualbudget yarn[1192]: Node.js v20.19.0 Apr 09 08:01:49 actualbudget systemd[1]: actualbudget.service: Main process exited, code=exited, status=1/FAILURE Apr 09 08:01:49 actualbudget systemd[1]: actualbudget.service: Failed with result 'exit-code'. Apr 09 08:01:49 actualbudget systemd[1]: actualbudget.service: Consumed 2.956s CPU time.```
Author
Owner

@dannyellis commented on GitHub (Apr 9, 2025):

I'm having a similar issue with the Proxmox Helper Script after updating from 25.3.1 to 25.4.0. Migrations are failing:

Apr 09 08:01:47 actualbudget systemd[1]: actualbudget.service: Consumed 3.563s CPU time.
Apr 09 08:01:47 actualbudget systemd[1]: Started actualbudget.service - Actual Budget Service.
Apr 09 08:01:49 actualbudget yarn[1192]: Checking if there are any migrations to run for direction "up"...
Apr 09 08:01:49 actualbudget yarn[1192]: /opt/actualbudget/node_modules/better-sqlite3/lib/methods/wrappers.js:9
Apr 09 08:01:49 actualbudget yarn[1192]:         this[cppdb].exec(sql);
Apr 09 08:01:49 actualbudget yarn[1192]:                     ^
Apr 09 08:01:49 actualbudget yarn[1192]: SqliteError: no such column: password
Apr 09 08:01:49 actualbudget yarn[1192]:     at Database.exec (/opt/actualbudget/node_modules/better-sqlite3/lib/methods>
Apr 09 08:01:49 actualbudget yarn[1192]:     at WrappedDatabase.exec (file:///opt/actualbudget/packages/sync-server/src/>
Apr 09 08:01:49 actualbudget yarn[1192]:     at Migration.up (file:///opt/actualbudget/packages/sync-server/migrations/1>
Apr 09 08:01:49 actualbudget yarn[1192]:     at next (/opt/actualbudget/node_modules/migrate/lib/migrate.js:35:45)
Apr 09 08:01:49 actualbudget yarn[1192]:     at migrate (/opt/actualbudget/node_modules/migrate/lib/migrate.js:76:3)
Apr 09 08:01:49 actualbudget yarn[1192]:     at MigrationSet.migrate (/opt/actualbudget/node_modules/migrate/lib/set.js:>
Apr 09 08:01:49 actualbudget yarn[1192]:     at MigrationSet.up (/opt/actualbudget/node_modules/migrate/lib/set.js:107:8)
Apr 09 08:01:49 actualbudget yarn[1192]:     at file:///opt/actualbudget/packages/sync-server/src/migrations.js:25:23
Apr 09 08:01:49 actualbudget yarn[1192]:     at /opt/actualbudget/node_modules/migrate/index.js:62:5
Apr 09 08:01:49 actualbudget yarn[1192]:     at /opt/actualbudget/node_modules/migrate/lib/load-migrations.js:97:7 {
Apr 09 08:01:49 actualbudget yarn[1192]:   code: 'SQLITE_ERROR'
Apr 09 08:01:49 actualbudget yarn[1192]: }
Apr 09 08:01:49 actualbudget yarn[1192]: Node.js v20.19.0
Apr 09 08:01:49 actualbudget systemd[1]: actualbudget.service: Main process exited, code=exited, status=1/FAILURE
Apr 09 08:01:49 actualbudget systemd[1]: actualbudget.service: Failed with result 'exit-code'.
Apr 09 08:01:49 actualbudget systemd[1]: actualbudget.service: Consumed 2.956s CPU time.```

In the same boat. Working on a fix and will let you know. I can see why they do not like this project over there. Node sucks as well

@dannyellis commented on GitHub (Apr 9, 2025): > I'm having a similar issue with the Proxmox Helper Script after updating from 25.3.1 to 25.4.0. Migrations are failing: > > ``` > Apr 09 08:01:47 actualbudget systemd[1]: actualbudget.service: Consumed 3.563s CPU time. > Apr 09 08:01:47 actualbudget systemd[1]: Started actualbudget.service - Actual Budget Service. > Apr 09 08:01:49 actualbudget yarn[1192]: Checking if there are any migrations to run for direction "up"... > Apr 09 08:01:49 actualbudget yarn[1192]: /opt/actualbudget/node_modules/better-sqlite3/lib/methods/wrappers.js:9 > Apr 09 08:01:49 actualbudget yarn[1192]: this[cppdb].exec(sql); > Apr 09 08:01:49 actualbudget yarn[1192]: ^ > Apr 09 08:01:49 actualbudget yarn[1192]: SqliteError: no such column: password > Apr 09 08:01:49 actualbudget yarn[1192]: at Database.exec (/opt/actualbudget/node_modules/better-sqlite3/lib/methods> > Apr 09 08:01:49 actualbudget yarn[1192]: at WrappedDatabase.exec (file:///opt/actualbudget/packages/sync-server/src/> > Apr 09 08:01:49 actualbudget yarn[1192]: at Migration.up (file:///opt/actualbudget/packages/sync-server/migrations/1> > Apr 09 08:01:49 actualbudget yarn[1192]: at next (/opt/actualbudget/node_modules/migrate/lib/migrate.js:35:45) > Apr 09 08:01:49 actualbudget yarn[1192]: at migrate (/opt/actualbudget/node_modules/migrate/lib/migrate.js:76:3) > Apr 09 08:01:49 actualbudget yarn[1192]: at MigrationSet.migrate (/opt/actualbudget/node_modules/migrate/lib/set.js:> > Apr 09 08:01:49 actualbudget yarn[1192]: at MigrationSet.up (/opt/actualbudget/node_modules/migrate/lib/set.js:107:8) > Apr 09 08:01:49 actualbudget yarn[1192]: at file:///opt/actualbudget/packages/sync-server/src/migrations.js:25:23 > Apr 09 08:01:49 actualbudget yarn[1192]: at /opt/actualbudget/node_modules/migrate/index.js:62:5 > Apr 09 08:01:49 actualbudget yarn[1192]: at /opt/actualbudget/node_modules/migrate/lib/load-migrations.js:97:7 { > Apr 09 08:01:49 actualbudget yarn[1192]: code: 'SQLITE_ERROR' > Apr 09 08:01:49 actualbudget yarn[1192]: } > Apr 09 08:01:49 actualbudget yarn[1192]: Node.js v20.19.0 > Apr 09 08:01:49 actualbudget systemd[1]: actualbudget.service: Main process exited, code=exited, status=1/FAILURE > Apr 09 08:01:49 actualbudget systemd[1]: actualbudget.service: Failed with result 'exit-code'. > Apr 09 08:01:49 actualbudget systemd[1]: actualbudget.service: Consumed 2.956s CPU time.``` > ``` In the same boat. Working on a fix and will let you know. I can see why they do not like this project over there. Node sucks as well
Author
Owner

@dannyellis commented on GitHub (Apr 9, 2025):

@motoridersd I have a PR up at the help script but not sure it will work for you as you have already tried to upgrade

https://github.com/community-scripts/ProxmoxVE/pull/3793

For you though go to your container and see what is in /opt/actualbudget-data/.migrate (it's a file)

If you have null values for the two last keypair values you will want to update them to be the ones referenced above

@dannyellis commented on GitHub (Apr 9, 2025): @motoridersd I have a PR up at the help script but not sure it will work for you as you have already tried to upgrade https://github.com/community-scripts/ProxmoxVE/pull/3793 For you though go to your container and see what is in /opt/actualbudget-data/.migrate (it's a file) If you have null values for the two last keypair values you will want to update them to be the ones referenced above
Author
Owner

@motoridersd commented on GitHub (Apr 9, 2025):

Thank you! I restored my nightly backup to get back up and running, so I can run the updated script to update it.

@motoridersd commented on GitHub (Apr 9, 2025): Thank you! I restored my nightly backup to get back up and running, so I can run the updated script to update it.
Author
Owner

@dannyellis commented on GitHub (Apr 9, 2025):

Thank you! I restored my nightly backup to get back up and running, so I can run the updated script to update it.

Let me know how it works once it gets merged. I tested from a diff version than you

@dannyellis commented on GitHub (Apr 9, 2025): > Thank you! I restored my nightly backup to get back up and running, so I can run the updated script to update it. Let me know how it works once it gets merged. I tested from a diff version than you
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#1661