zotero not synching and showing error message

Hi,

For some reason zotero has stopped synching from my mac computer. I added a number of sources on zotero on my mac but they are no longer showing up in the online version of zotero. I have my preferences set to synch so this is not the issue.

The following error message does appear in the top right of zotero on my mac computer so I am not sure if that is causing the issue: Error(s) encountered during statement execution: FOREIGN KEY constraint failed [QUERY: DELETE FROM items WHERE itemID=?] [PARAMS: 4418] [ERROR: FOREIGN KEY constraint failed].

I also have automatic time machine back up set up on my mac computer but this did not previously cause an issue. There are a large number of files/documents set up on my zotero on my mac and I do not want to lose these as it took days to set them up. Any assistance you can provide would be greatly appreciated.

Thanks so much.

Michelle
  • Can you provide a Debug ID for reproducing this?

    You should also check your database integrity from the Advanced → Files and Folders pane of the Zotero settings.
  • The Debug ID is: D11361668


    When I check the database integrity the following message comes up: You can use the database repair tool at http://zotero.org/utils/dbfix to attempt to correct these errors.

    Please advise further on how to resolve this issue.

    Thanks so much.
  • edited November 26, 2024
    So your database is corrupted. (Do you have it in the default location in your home folder, or have you moved it elsewhere?)

    If all your data were online, you could just delete the zotero.sqlite database, restart Zotero, and sync to pull down your data. But it sounds like you've added data recently that hasn't synced due to this error (which maybe was happening for a while)?

    In that case, you'd have to either try the DB Repair Tool linked from there or restore from a backup. If you've been using Time Machine, you should be able to restore from a backup of zotero.sqlite. You'll need to find one that's after recent data was added (at least as much as possible) but before your database was corrupted.
  • Thanks for getting back to me. I am not sure what you mean by home folder, could you please clarify? And yes, you are correct I added data that has not synched due to the error/corruption. I don't know when the database was corrupted so I am not sure what backup version to use. Also I don't want to lose the data that I recently added and if I restore the version before it was corrupted then would I not lose that data?
  • edited 29 days ago
    Your home folder is the folder with your name on it, where you can find Desktop/Documents/Pictures/etc. That's the default location of the Zotero data directory. You can check the current data directory location from the Advanced → Files and Folders section of the Zotero settings.
    I don't know when the database was corrupted so I am not sure what backup version to use
    You'd have to try restoring copies of zotero.sqlite from Time Machine — starting with the most recent — and then syncing and seeing if you get the error.
    I don't want to lose the data that I recently added and if I restore the version before it was corrupted then would I not lose that data?
    You'd lose data after the backup if it hasn't been synced up to your online library, yes. That's why we provide the DB Repair Tool.
  • Thanks for getting back to me and for your answers to my questions. In answer to your question, based on the information you provided yes, the database is in my home folder.

    I understand that I will lose the data if I restore the version that was not corrupted since I added data after the corruption occured. Will I also lose the data if I use the DB Repair Tool? (If so I will have to cross compare the data on my mac with the online version and input one by one the data missing from the online version - I would prefer not to do this as it will likely take days because of all the data on zotero)

    I was also wondering if it is possible to determine the source of the corruption to avoid this happening again as it is costing me time which I cannot afford to lose moving forward.
  • No, as I say, the point of the DB Repair Tool is to try to repair your database so that you don't lose data.

    Generally speaking, your database should never get corrupted if it's in the default location on your disk, unless there was actual disk/filesystem corruption. It's much more likely to happen if you've moved your database somewhere else.

    If your data directory location is set to the default and you're using Time Machine and syncing, you're really doing everything right, and you should be able to restore a fairly recent version from a backup and/or from syncing.

    But both Time Machine and the online library could be a bit behind if you didn't notice when this started happening. In a future version, we'll be making the warning more prominent if syncing isn't happening.
    If so I will have to cross compare the data on my mac with the online version and input one by one the data missing from the online version
    No, you would just need to sort both by Date Added or Date Modified, export the recent items to Zotero RDF, delete zotero.sqlite and restart Zotero to sync down a fresh copy of the data, and then import the RDF file.
  • Okay thank you for that clarification, much appreciated.
  • As per your instructions I ran the DB Repair Tool - it fixed the corrupted database and everything appears to be functioning now. One other thing that I noticed is that my zotero was still the 6 version and I updated it to the 7 version. Somehow I missed this update when it came out in August which my have contributed to the corrupted database. Is there any way to get an automatic notification for any future updates directly on the local version of zotero on my mac? Thanks again.
  • We haven't pushed Zotero 7 as a suggested update yet, so you only get it if you manually do Help → Check for Updates or download it from the download page. The version wouldn't have anything to do with DB corruption, though.
Sign In or Register to comment.