Help! Corrupted database (and the usual fixes are not working and/or I'm unsure if they're safe)

Please help! This is very time-sensitive, and I haven't been able to find an existing solution in the forums yet. So, I hadn't used Zotero in a while, and when I opened it today, everything looked fine - my files were all there. But I figured it probably needed updating, and so I checked for and installed an update. Now, it opens, shows the following error, and then force closes itself:

Error: Error(s) encountered during statement execution: database disk image is malformed [QUERY: SELECT COUNT(*) > 0 FROM fulltextItemWords WHERE itemID NOT IN (SELECT itemID FROM items WHERE itemTypeID=14)] [PARAMS: ] [ERROR: database disk image is malformed]
From previous event:

I'm unable to fix it by the instructions on this page (, although I haven't run the Database Repair Tool yet because that sounds like a last resort, and I'm worried I'll lose data if doing that. I do not have Zotero being backed up by any cloud services, so that's not the problem. I didn't change anything except simply updating the application. I have not tried to download it from my online sync yet because I'm not certain that everything was synced. I'm actually pretty sure it was NOT all synced because I had run out of online storage.

I assume this is because I tried to open Zotero multiple times, but it apparently overwrote the automatic backup sqlite files on my computer. The 3 “zotero.sqlite” files in my directory (one regular, 2 "bak") all appear to have been modified AFTER I updated Zotero (i.e., are timestamped for this evening), so I do not know how to roll back whatever went wrong and can't follow that part of the troubleshooting instructions for a corrupt error message.

FWIW, the directory appears to be in the normal place (C:\Users\myusername\Zotero), and I assume that's also where it was before I updated. The sqlite files are each all the same size: 78,756 kb...although my online account says I'm syncing 300 MB, not 79 MB. I assume some discrepancy is expected...? I'm not sure; it's not my area of expertise, but this difference is the main reason I'm hesitating to try and sync with my online library. Will this overwrite anything I had locally saved in Zotero, given that I'm pretty sure it stopped syncing a while back once I hit my quota? (And if it didn't stop syncing, how can I even keep the online version from syncing the local, presumably corrupted file?)

Lastly, if relevant, I can see that there are still storage files on my computer in the Zotero folder (with a much older modification date - most of them have the same or a similar timestamp as each other, though).

Perhaps I'm being too cautious in what I'm trying, but I really, really don't want to lose data, including notes I've made and organizational structure, by syncing with online, especially since it doesn't appear that data is GONE but rather stuck in some error loop. Thank you in advance to anyone who can help! This is not my area of expertise...
  • First, before you do anything, make sure you have a full backup of your Zotero data directory.

    Then, a few clarifications:

    1) DB corruption wouldn't happen from updating Zotero. It would be caused by something on your computer corrupting the file. Generally that's storing the data directory in a cloud storage folder, but in your case it could be a problem with the disk or the system crashing while Zotero was writing to the database (though even that generally should be fine). I'm not sure what you mean by "I assume this is because I tried to open Zotero multiple times", and that could potentially be related, but generally it shouldn't be possible to open Zotero more than once — you'd just get a warning that it was already open.
    78,756 kb...although my online account says I'm syncing 300 MB, not 79 MB.
    2) These aren't related. 300 MB is your storage quota. The size of your database is completely unrelated. Data syncing is unlimited.

    3) You're at your storage quota, which means not all your attachments have been uploaded, but the corruption is just about the database file, zotero.sqlite. Nothing to do with your attachment files.

    You can simply look in your online library on this site to see whether your data is intact here. If it is, you can just delete zotero.sqlite in your Zotero data directory (which you've already made a backup of) and sync to pull down all the data in your online library.
  • Thank you so much for the swift reply. I am not certain that everything is there online, but there are some relatively recent things at least. So, I deleted the zotero.sqlite file from my computer (after making a backup). When I opened Zotero up again, I got a warning message saying that I am about to sync my account to an empty Zotero database. The way this is worded doesn't make me feel 100% confident that it's going to download my existing data from Zotero, as opposed to syncing my account with an empty database and therefore overwriting the existing data. Just to be safe, would you mind confirming that it means the former and that I should, in fact, proceed with the sync?
  • Yes.

    We've clarified the message for the next major version:
    You are about to sync to an empty Zotero database. This could happen if you accidentally deleted the zotero.sqlite file in your Zotero data directory or the location of your data directory changed.

    If you continue, data in the ‘[…]’ account will be downloaded to this computer. Your online library won’t be affected.
Sign In or Register to comment.