Replies: 1 comment
-
|
Not sure how that could have happend, as the server side should block/error if something happens like this. But normally it would just update/overwrite. I would suggest to backup, delete the oldest duplicate record and see what happens. According to the error message it mentions something about system date/time not being correct, and even that the server went back-in-time somehow. Maybe you changed the Timezone, or something else happend on the server/host. I also see that you are using an older version of Vaultwarden, if you are really running v1.33, that is (if using the latest 1.33 version) more then a year old. So, i would also strongly suggest to update to the latest version of Vaultwarden, try to repair the database and see what happens. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Prerequisites
Vaultwarden Support String
I'm running a self-hosted Bitwarden instance (Vaultwarden) and recently encountered a database corruption error: database disk image is malformed. After investigation, I suspect the root cause might be related to a new device having an incorrect system time (NTP not synchronized, clock set to the past) during synchronization, leading to duplicate entries with the same UUID.
Has anyone encountered a similar issue? Could an incorrect client time really trigger this kind of duplicate primary key insertion?
What would be the safest way to repair the database (e.g., removing duplicate entries based on the most recent revision date)?
Are there any safeguards that could be implemented in Bitwarden/Vaultwarden to prevent such corruption, such as validating client timestamps or using stronger conflict resolution?
Any guidance or insights would be greatly appreciated. Thank you!
Vaultwarden Build Version
v1.33
Deployment method
Official Container Image
Custom deployment method
No response
Reverse Proxy
nginx1.26
Host/Server Operating System
Linux
Operating System Version
No response
Clients
Browser Extension
Client Version
No response
Steps To Reproduce
I used sqlite3 to dump the database and look for issues:
text
sqlite3 db.sqlite3 ".dump" > backup.sql
sqlite3 fix.db < backup.sql
During this process, I found several pairs of rows sharing the same UUID but with different encrypted data and revision timestamps.
Here is an example of two conflicting ciphers entries (sensitive data has been redacted):
sql
INSERT INTO ciphers VALUES('d12ddef9-2f41-4d56-b09c-7ed45e95a5df','2023-04-08 04:11:07.581302684','2025-11-30 05:06:03.152207604','7d4b45db-df2e-468d-9767-ed64e18d066b',NULL,1,'2.rotn3twrTfb/3srs0ibR8w==|...','...','...','{"fido2Credentials":[],"password":"...","passwordRevisionDate":"2023-07-21T17:58:53.531Z","totp":null,"uris":[{"match":1,"uri":"...","uriChecksum":"..."}],"username":"..."}','[{"lastUsedDate":"2023-07-21T17:58:53.531Z","password":"..."}]',NULL,0,NULL);
INSERT INTO ciphers VALUES('d12ddef9-2f41-4d56-b09c-7ed45e95a5df','2023-04-08 04:11:07.581302684','2024-05-01 04:25:24.219123814','7d4b45db-df2e-468d-9767-ed64e18d066b',NULL,1,'2.62ScH8llICZtFJ9bsgmjFA==|...','...','...','{"Password":"...","PasswordRevisionDate":"2023-07-21T17:58:53.531Z","Totp":null,"Uris":[{"Match":3,"Uri":"...","UriChecksum":"..."},{"Match":1,"Uri":"...","UriChecksum":"..."}],"Username":"..."}','[{"LastUsedDate":"2023-07-21T17:58:53.531Z","Password":"..."}]',NULL,0,NULL);
Both records have the same UUID (d12ddef9-2f41-4d56-b09c-7ed45e95a5df).
Their encrypted data (e.g., name, data, password history) are completely different.
The revision timestamps are inconsistent: one is in 2025 (future) and the other in 2024 (past), while the creation date is identical.
The JSON structure in the data column also differs in key casing (lowercase vs. uppercase), suggesting they may come from different client versions or corrupted states.
Expected Result
/
Actual Result
A new device with an incorrect system time (e.g., clock set to a date in the past) might have attempted to sync/update entries. This could have caused the server to accept updates with old timestamps, leading to duplicate rows with the same UUID, eventually corrupting the database.
Logs
Screenshots or Videos
No response
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions