Sync Error "Item collection 462 not found"

Dear Zotero community,

the Zotero library on my desktop does not synchronize any more with my Zotero online storage. I constantly get the following error message upon synchronising my database (ID: 1396855052):

[JavaScript Error: "Item collection 462 not found" {file: "chrome://zotero/content/xpcom/data/item.js" line: 4482}]

[JavaScript Error: "Item collection 462 not found" {file: "chrome://zotero/content/xpcom/data/item.js" line: 4482}]

[JavaScript Error: "Item collection 462 not found" {file: "chrome://zotero/content/xpcom/data/item.js" line: 4482}]

[JavaScript Error: "Item collection 462 not found" {file: "chrome://zotero/content/xpcom/data/item.js" line: 4482}]

version => 5.0.82, platform => Win32, oscpu => Windows NT 10.0; WOW64, locale => de, appName => Zotero, appVersion => 5.0.82, extensions => Zutilo Dienstprogramm für Zotero (2.0.4, extension), Zotero Scholar Citations (1.9.3, extension), Zotero Storage Scanner (5.0.8, extension), Zotero LibreOffice Integration (5.0.21.SA.5.0.82, extension), Zotero Word for Windows Integration (5.0.14.SA.5.0.82, extension), ZotFile (5.0.16, extension), Shockwave Flash (32.0.0.223, plugin)



I have tried to solve this problem by myself unsuccessfully. Restarting Zotero does not help. I also tried to uninstall Zotero from my Computer and reinstall it (using the zotero.sqlite file). The error persists. I have also checked for database integrity (which seems to be fine). Otherwise, my Zotero is working perfectly. Just the syncing does not work.

I will very much appreciate your help!
  • Can you provide a Debug ID (different from a Report ID) for a sync that produces this error?
  • Sure, the Debug ID is D301826092. Thank you so much for your fast help!
  • edited February 10, 2020
    Sorry, Zotero was refreshing your feeds during that sync, which pushed the relevant lines out of the log. Can you provide another one?
  • I am sorry, here is a new one: D1514946120. Just in case - here are more: D1257551120, D2090571696, D818366097. Thank you very much!
  • When I start the Syncing by clicking on the green arrow in the Zotero Standalone version, it immediately stops after one second or so due to this error...
  • Has anyone already been able to look into that error? I will be happy to provide more information or details!
  • Sorry for the delay.

    You're saying you've checked database integrity from the Advanced → Files and Folders pane of the Zotero preferences and it said no errors were found? Because this error would definitely occur from a particular kind of DB corruption that that check should be able to detect and correct.

    If you run that again and it doesn't find any errors, can you go to Tools → Developer → Run JavaScript and paste in the following code, and let me know the result?

    return [
    await Zotero.DB.valueQueryAsync("SELECT key FROM collections WHERE collectionID=462"),
    await Zotero.DB.columnQueryAsync("SELECT key FROM items WHERE itemID IN (SELECT itemID FROM collectionItems WHERE collectionID=462)")
    ];
  • Thank you so much for getting back to me! I checked database integrity from the Advanced → Files and Folders pane of the Zotero preferences again, and again no errors were found.

    I ran your JavaScript with the following result:

    [
    "0": false
    "1": [
    "0": "BN5BZRIH"
    "1": "F6BV9Z22"
    "2": "5ARGNU45"
    "3": "8FE97D53"
    "4": "ZQRX2KQJ"
    "5": "LXEGUDK6"
    "6": "HSWGMK6G"
    "7": "YMC8ULWN"
    "8": "WXBLQBG4"
    ]
    ]



    What do you think?
  • Sorry, I keep letting this slip through the cracks. We can get this fixed for you today.

    Basically, your database somehow has nine items that are listed as being in a collection that doesn't exist, and the checks in the database that are supposed to make sure that doesn't happen, and to correct it if it does, don't seem to be in place.

    Could you run this in the Run JavaScript window and let me know the result?

    return await Zotero.DB.valueQueryAsync("SELECT sql FROM sqlite_master WHERE type='table' AND name='collectionItems'");
  • No worries, thank you so much for your help! I get the following result:

    CREATE TABLE collectionItems (
    collectionID INT NOT NULL,
    itemID INT NOT NULL,
    orderIndex INT NOT NULL DEFAULT 0,
    PRIMARY KEY (collectionID, itemID),
    FOREIGN KEY (collectionID) REFERENCES collections(collectionID) ON DELETE CASCADE,
    FOREIGN KEY (itemID) REFERENCES items(itemID) ON DELETE CASCADE
    )



    What do you think?
  • That's really quite strange. This shouldn't be possible based on the state of your database.

    If your database is small enough and you don't mind, you can try uploading it to the DB Repair Tool and swapping in the rebuilt database to see if that fixes the problem. If it doesn't, if you let us know the Upload ID from the repair tool, we can run some tests on the file to see what's going on.

    Alternatively, you can simply run this command to delete the invalid collection-item associations, and then restart Zotero, but I couldn't guarantee that this wouldn't somehow happen again:

    return await Zotero.DB.valueQueryAsync("DELETE FROM collectionItems WHERE collectionID=462");
  • I ran your command to delete the invalid collection-item associations, and then restarted Zotero. This solved the problem - my whole library is now synchronised! Thank you so much! I really appreciate your great help! Should this problem reoccur, I will let you know.
Sign In or Register to comment.