postgres database / cannot save entries with error msg re: favorite #859

Closed
opened 2026-02-04 23:07:11 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @joergmschulz on GitHub (Nov 11, 2020).

Subject of the issue

Trying to save entries, an error occurs. The logfile says:
[CAUSE] DatabaseError( bitwarden_rs | __Unknown, bitwarden_rs | "null value in column \"favorite\" violates not-null constraint",

Your environment

  • Bitwarden_rs version:
    Version 1.17.0-e25fc708

docker image bitwardenrs/server-postgresql:testing and bitwardenrs/server-postgresql

Steps to reproduce

enter data in existing records
save the data

Expected behaviour

data should be saved

Actual behaviourop cit error message (column "favorite" violates not-null constraint",)

Relevant logs

Originally created by @joergmschulz on GitHub (Nov 11, 2020). ### Subject of the issue Trying to save entries, an error occurs. The logfile says: ` [CAUSE] DatabaseError( bitwarden_rs | __Unknown, bitwarden_rs | "null value in column \"favorite\" violates not-null constraint", ` ### Your environment <!-- The version number, obtained from the logs or the admin diagnostics page --> <!-- Remember to check your issue on the latest version first! --> * Bitwarden_rs version: Version 1.17.0-e25fc708 <!-- How the server was installed: Docker image / package / built from source --> docker image bitwardenrs/server-postgresql:testing and bitwardenrs/server-postgresql ### Steps to reproduce <!-- Tell us how to reproduce this issue. What parameters did you set (differently from the defaults) and how did you start bitwarden_rs? --> enter data in existing records save the data ### Expected behaviour data should be saved ### Actual behaviourop cit error message (column \"favorite\" violates not-null constraint",) ### Relevant logs <!-- Share some logfiles, screenshots or output of relevant programs with us. -->
OVERLORD added the questiontroubleshooting labels 2026-02-04 23:07:11 +03:00
Author
Owner

@BlackDex commented on GitHub (Nov 18, 2020):

Hello @joergmschulz, could you please provide some more information?
Looking at the error it seems to be something regarding toggling an item as favorite on/off.
But you state it happens during editing an item.

I have tried the following scenarios.

  • Toggle an item as favorite, then save.
  • Un-toggle an item as favorite, then save.
  • Toggle an item as favorite, save, edit that same item again, save
  • Toggle an item and make changes at the same time then save
  • Un-toggle an item and make changes at the same time then save

All of these are working without producing any error at all.
It could be that your database is broken for some reason.
If that is the case i would suggest to check the favorites table and look for null values and remove them.
It doesn't pose any harm, except for maybe losing a favorite flag on an item.

@BlackDex commented on GitHub (Nov 18, 2020): Hello @joergmschulz, could you please provide some more information? Looking at the error it seems to be something regarding toggling an item as favorite on/off. But you state it happens during editing an item. I have tried the following scenarios. - Toggle an item as favorite, then save. - Un-toggle an item as favorite, then save. - Toggle an item as favorite, save, edit that same item again, save - Toggle an item and make changes at the same time then save - Un-toggle an item and make changes at the same time then save All of these are working without producing any error at all. It could be that your database is broken for some reason. If that is the case i would suggest to check the `favorites` table and look for `null` values and remove them. It doesn't pose any harm, except for maybe losing a favorite flag on an item.
Author
Owner

@joergmschulz commented on GitHub (Nov 19, 2020):

Do you use postgres?
I've removed the not-null constraint for the favorite column as a workaround. Later the week, I'll rebuild a test instance and retest.

@joergmschulz commented on GitHub (Nov 19, 2020): Do you use postgres? I've removed the not-null constraint for the favorite column as a workaround. Later the week, I'll rebuild a test instance and retest.
Author
Owner

@BlackDex commented on GitHub (Nov 19, 2020):

Yes i did use postgresql for these tests.
Would be nice to know what could have happened.

@BlackDex commented on GitHub (Nov 19, 2020): Yes i did use postgresql for these tests. Would be nice to know what could have happened.
Author
Owner

@jjlin commented on GitHub (Nov 19, 2020):

There should no longer even be a favorite column in 1.17.0, so something probably went wrong in the migrations:

5379329ef7/migrations/postgresql/2020-08-02-025025_add_favorites_table/up.sql (L15-L16)

@jjlin commented on GitHub (Nov 19, 2020): There should no longer even be a `favorite` column in 1.17.0, so something probably went wrong in the migrations: https://github.com/dani-garcia/bitwarden_rs/blob/5379329ef71ba4b600eb028d721806a16e62535f/migrations/postgresql/2020-08-02-025025_add_favorites_table/up.sql#L15-L16
Author
Owner

@joergmschulz commented on GitHub (Nov 19, 2020):

hmmm, this might have happened during the switch from a devel package to the next release. If and when nobody else can reproduce this issue, this seems to be a local thing here not worth following up.

@joergmschulz commented on GitHub (Nov 19, 2020): hmmm, this might have happened during the switch from a devel package to the next release. If and when nobody else can reproduce this issue, this seems to be a local thing here not worth following up.
Author
Owner

@joergmschulz commented on GitHub (Nov 19, 2020):

did now
ALTER TABLE ciphers
DROP COLUMN favorite;
seems to work fine.
Assuming it really is a local issue due to intermediary using a devel version, I close this one. On next upgrade, I seem to have to watch log messages more carefully.
Thank you for the support!

@joergmschulz commented on GitHub (Nov 19, 2020): did now ALTER TABLE ciphers DROP COLUMN favorite; seems to work fine. Assuming it really is a local issue due to intermediary using a devel version, I close this one. On next upgrade, I seem to have to watch log messages more carefully. Thank you for the support!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/vaultwarden#859