[GH-ISSUE #1919] cause: SqliteError: NOT NULL constraint failed: user.bookmarkClickAction #1188

Closed
opened 2026-03-02 11:55:38 +03:00 by kerem · 3 comments
Owner

Originally created by @halkeye on GitHub (Sep 8, 2025).
Original GitHub issue: https://github.com/karakeep-app/karakeep/issues/1919

Describe the Bug

On startup of ghcr.io/karakeep-app/karakeep:0.27.0 image i'm getting the following output in logs

/package/admin/s6-overlay/libexec/preinit: info: /run belongs to uid 0 instead of 1000 - fixing it
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service init-db-migration: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
Running db migration script
s6-rc: info: service legacy-cont-init successfully started
file:///db_migrations/index.js:7854
      throw new DrizzleError({ cause: err, message: `Failed to run the query '${staticQuery.sql}'` });
            ^
DrizzleError: Failed to run the query '
UPDATE `user` SET
  `bookmarkClickAction` = (
    SELECT `bookmarkClickAction` FROM `userSettings` WHERE `userSettings`.`userId` = `user`.`id`
  ),
  `archiveDisplayBehaviour` = (
    SELECT `archiveDisplayBehaviour` FROM `userSettings` WHERE `userSettings`.`userId` = `user`.`id`
  ),
  `timezone` = (
    SELECT `timezone` FROM `userSettings` WHERE `userSettings`.`userId` = `user`.`id`
  );'
    at BetterSQLiteSession.run (file:///db_migrations/index.js:7854:13)
    at SQLiteSyncDialect.migrate (file:///db_migrations/index.js:5712:21)
    ... 4 lines matching cause stack trace ...
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) {
  cause: SqliteError: NOT NULL constraint failed: user.bookmarkClickAction
      at PreparedQuery.run (file:///db_migrations/index.js:7969:22)
      at BetterSQLiteSession.run (file:///db_migrations/index.js:7852:74)
      at SQLiteSyncDialect.migrate (file:///db_migrations/index.js:5712:21)
      at migrator_migrate (file:///db_migrations/index.js:2197:14)
      at file:///db_migrations/index.js:13874:1
      at ModuleJob.run (node:internal/modules/esm/module_job:345:25)
      at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26)
      at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) {
    code: 'SQLITE_CONSTRAINT_NOTNULL'
  }
}
Node.js v22.19.0
s6-rc: warning: unable to start service init-db-migration: command exited 1
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Steps to Reproduce

Purely guessing here cause i can't startup (I may just roll back to see)
Have user login but not finish onboarding
run migration script?

Expected Behaviour

Not crash

Screenshots or Additional Context

No response

Device Details

No response

Exact Karakeep Version

ghcr.io/karakeep-app/karakeep:0.27.0

Have you checked the troubleshooting guide?

  • I have checked the troubleshooting guide and I haven't found a solution to my problem
Originally created by @halkeye on GitHub (Sep 8, 2025). Original GitHub issue: https://github.com/karakeep-app/karakeep/issues/1919 ### Describe the Bug On startup of ghcr.io/karakeep-app/karakeep:0.27.0 image i'm getting the following output in logs ``` /package/admin/s6-overlay/libexec/preinit: info: /run belongs to uid 0 instead of 1000 - fixing it s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service init-db-migration: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting Running db migration script s6-rc: info: service legacy-cont-init successfully started file:///db_migrations/index.js:7854 throw new DrizzleError({ cause: err, message: `Failed to run the query '${staticQuery.sql}'` }); ^ DrizzleError: Failed to run the query ' UPDATE `user` SET `bookmarkClickAction` = ( SELECT `bookmarkClickAction` FROM `userSettings` WHERE `userSettings`.`userId` = `user`.`id` ), `archiveDisplayBehaviour` = ( SELECT `archiveDisplayBehaviour` FROM `userSettings` WHERE `userSettings`.`userId` = `user`.`id` ), `timezone` = ( SELECT `timezone` FROM `userSettings` WHERE `userSettings`.`userId` = `user`.`id` );' at BetterSQLiteSession.run (file:///db_migrations/index.js:7854:13) at SQLiteSyncDialect.migrate (file:///db_migrations/index.js:5712:21) ... 4 lines matching cause stack trace ... at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) { cause: SqliteError: NOT NULL constraint failed: user.bookmarkClickAction at PreparedQuery.run (file:///db_migrations/index.js:7969:22) at BetterSQLiteSession.run (file:///db_migrations/index.js:7852:74) at SQLiteSyncDialect.migrate (file:///db_migrations/index.js:5712:21) at migrator_migrate (file:///db_migrations/index.js:2197:14) at file:///db_migrations/index.js:13874:1 at ModuleJob.run (node:internal/modules/esm/module_job:345:25) at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) { code: 'SQLITE_CONSTRAINT_NOTNULL' } } Node.js v22.19.0 s6-rc: warning: unable to start service init-db-migration: command exited 1 s6-rc: info: service legacy-cont-init: stopping s6-rc: info: service legacy-cont-init successfully stopped s6-rc: info: service fix-attrs: stopping s6-rc: info: service fix-attrs successfully stopped s6-rc: info: service s6rc-oneshot-runner: stopping s6-rc: info: service s6rc-oneshot-runner successfully stopped ``` ### Steps to Reproduce Purely guessing here cause i can't startup (I may just roll back to see) Have user login but not finish onboarding run migration script? ### Expected Behaviour Not crash ### Screenshots or Additional Context _No response_ ### Device Details _No response_ ### Exact Karakeep Version ghcr.io/karakeep-app/karakeep:0.27.0 ### Have you checked the troubleshooting guide? - [x] I have checked the troubleshooting guide and I haven't found a solution to my problem
kerem 2026-03-02 11:55:38 +03:00
Author
Owner

@halkeye commented on GitHub (Sep 8, 2025):

yep yep

sqlite> SELECT count(*) FROM `userSettings`;
5
sqlite> SELECT count(*) FROM `user`;
6
<!-- gh-comment-id:3268273243 --> @halkeye commented on GitHub (Sep 8, 2025): yep yep ``` sqlite> SELECT count(*) FROM `userSettings`; 5 sqlite> SELECT count(*) FROM `user`; 6 ```
Author
Owner

@halkeye commented on GitHub (Sep 8, 2025):

select coalesce(bookmarkClickAction, 'open_original_link') from user left join userSettings on user.id=userSettings.userId;
does give me defaults even for ones that don't have them

<!-- gh-comment-id:3268304644 --> @halkeye commented on GitHub (Sep 8, 2025): ```select coalesce(bookmarkClickAction, 'open_original_link') from user left join userSettings on user.id=userSettings.userId;``` does give me defaults even for ones that don't have them
Author
Owner

@halkeye commented on GitHub (Sep 8, 2025):

🤞 https://github.com/karakeep-app/karakeep/pull/1920

<!-- gh-comment-id:3268316153 --> @halkeye commented on GitHub (Sep 8, 2025): 🤞 https://github.com/karakeep-app/karakeep/pull/1920
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/karakeep#1188
No description provided.