Restore a deleted collection?

My problem: Moments ago I accidentally deleted a collection (with two sub collections) from my Zotero library (on computer "A"). First, I tried to edit/undo, but this wasn't possible. Second, I checked the Zotero trash, but it wasn't there. Third, I tried to restore data from the Zotero Server, and it deleted all my local files, but when it restored it did so without the deleted collection, which makes me think it synced in the moment between my deleting it and noticing it was deleted. When I check my library online the missing collection is, in fact, missing.

My first question is this, is there a spot where I can locate the missing collection (and sub-collections) and I'm just too stupid to figure this out? Or, are they truly gone?

My next question is this, I have Zotero on another computer (computer "B"), and I quickly shut off syncing on that computer and the missing collection (and sub-collections) is still there. Is there a way I can upload the missing collection from computer "B" to the Server, which will then add the collection to my library on computer "A"? Is that what a "Restore to Zotero Server" would do? Rewrite the material from what I have in computer "B"?

Thanks for any help you can provide.
  • the first thing to note is that you deleted only the collections, not the material _in_ the collection, which you can still find in "My Library".

    You have two options, I think:
    1. On computer B, create reports from the collection and subcollection and use those to (manually) recreate the collections on computer A.

    2. From computer B, use "Restore to Server"

    Option 1 is preferable if you have a lot of work on computer A that hasn't yet synced to computer B. Option 2 would delete any such work, but would, obviously, be a good bit faster.
  • adamsmith, thank you for your first response, and also your first comment. In my fear of losing the collection I had forgotten that I would not have lost the materials in them, that they would still be in my library. Thanks for the idea of option 1, despite the tediousness of it computer A has the most updated information, all computer B has is the lost collection and sub-collections. Usually I am good about keeping the two computers synced, but this was a busy semester and I fell behind (a good reminder to keep it up!).

    I will let you know if I have any questions about generating reports, etc.

    Thanks again, I really appreciate it.
  • A variant to Adam's suggestion (which I found online, but somehow can't find anymore):
    - Turn off automatic sync and close Zotero
    - Find out where your zotero.sqlite file is stored and rename it, for instance to zotero.sqlite_old.
    - Rename zotero.sqlite.bak to zotero.sqlite
    - Start Zotero. If you're lucky, you should see your deleted collection again
    - Create a new collection, name it 'Save Me'. Drag all items from the deleted collection into the new collection. This will prevent sync from deleting the information in your deleted collection.
    - Now sync your database. All information you added since the last backup but before you deleted your collection is added to your database again. Your deleted collection will disappear, but you have saved your data in 'Save Me'.
  • A simple undo function would be a lot more convenient, though. I've lost hour trying to recover accidentally deleted collections...
  • Thank you rickus!!!
  • I've just had this problem too. I geniunely cannot believe how silly this is. You have the ability for a recycle bin but if you accidently delete your collection EVERYTHING is gone. I've tried restoring i've tried getting the data back but it's no use. Everything is gone... I'm not happy.
  • You should be able to restore it from one of your automatic backups.
  • I agree that an "undo" option would prevent a lot of frustration...
  • Yes, please, please, please secure the collections in a better way.
    It is so easy to delete them without wanting and it is much to hard to get the data back.
    Maybe a checkbox in the confirmation pop-up would be the quickest way to help many users. Right now deleting a collection is like deleting one entry.
  • edited October 26, 2018
    Agreed that an undo/restore option for collections needs to be added. I just had a glitch where a heap of my collections and subcollections appeared to have duplicated. I deleted a bunch of the duplicates, and it was playing up weirdly so I reopened the program. Upon reopening it I discovered that heaps of collections and subcollections are gone (so presumably they never duplicated in the first place but just showed up as if they were). If there was a redo button it wouldn't matter, but since there isn't I have to hope I can restore some of the collections from another computer.
  • I just experienced the same thing as Riveon after updating to the latest version. Lost my entire library. I have lots of backup files so I am hoping I will be able to recover somehow.
  • Hi there, I've been using Zotero heavily for the past 4-years and it is just in the last 12-months that I've had the problem of missing collections. This has happened numerous times in the last year. But never before. It seems that something has changed that has made it way too easy to delete collections automatically. And like the above comments there is no easy way to get it back. I have thousands of entries and hundreds of sub-folders across my collections. The advice to rebuild manually is outrageous coming from Zotero staff. It's impossible to stay on top of every entry in every folder and sub-folder. Rebuilding is impossible. Thankfully I've been able to catch the fact that a folder is missing early enough to find it on my laptop. What I do is simply rename the master folder and for good measure I move it to another location in my tree and then sync my laptop and it then gets back up onto to the server.

    But honestly, must users have to endure constant heart attacks on behalf of a vital piece of software?

    We absolutely need a double-verify on the delete collection process. I agree a simple checkbox to go with the delete button would save many. This is a real serious problem.

    It's become such a problem I dread every time I go into Zotero to snap entries or even to access my file articles.

    Please help protect collections from accidental deletion.


  • @shakyegg: We're not aware of anything that's changed in the last year to cause this, nor have we witnessed any problems ourselves, and even you don't say how you think this is happening. A few people have reported the problem Riveon mentioned above of seemingly duplicated collections that then led to accidental deletions, so it seems like there's something there, but we haven't been able to reproduce that either. If you have any further details or reproduction steps, we'd want to know.
    The advice to rebuild manually is outrageous coming from Zotero staff.
    The only comment above from Zotero staff was from me, where I said this:
    You should be able to restore it from one of your automatic backups.
    Obviously that's not a great solution, but it's the best option at the moment, and it doesn't require rebuilding collections manually.

    We're working on undo functionality for collection deletions, which should be available soon.
  • Hey dstillman, thanks for the reply. I believe you had helped me 9-10 months ago when the problem first cropped up. The automatic backups didn't do the trick. But as mentioned above, so far I've been lucky to find the missing collections on my laptop before it synched. I wish I could say what the problem is. I am an expert computer user and file management nut case ;) Plus I'm very attentive to troubleshooting. as mentioned it's now happened 10 or 12 times. I believe it started with Zotero 5.0.

    The only thing I can think of is that the problem may lie somewhere in the create a new collection/subcollection process. I will right click to create a new sub-collection.

    I will start to type the name in and hit enter (without looking as I am looking at the keyboard) and then look back at Zotero and realize the new folder box is still there with "untitled" highlighted and the new name was not entered into the new folder dialogue box.

    So, this may mean that while the keyboard should be entering into the highlighted new collection/sub-collection name field the keyboard strokes are somehow deleting the last collection I had been working on. Maybe when I hit enter thinking it is "naming" and then "creating" the new collection, it is deleting the collection I was last on when I hit enter to create the new collection name.

    I can report that this collection/sub-collection naming issue has happened during every occurrence of collections going missing, since Zotero 5. It always happens when I am in deep organizing with Zotero which always necessitates creating new folders. I'd take a look into that. The bug might be in there.

    Ensuring that when a new collection/sub-collection is being created and the "untitled" is highlighted that indeed when the keyboard is used at that moment that it is entering into the naming filed of the new sub-collection field.

    I think that's where the problem is happening to me. It's not every time. It's intermittent the creating of a new sub-collection problem. What I can also report is in this process when I think I am typing in the new name into the folder and then hit enter, maybe that enter is triggering the delete. But there is no standard prompt that you regularly get with delete. So this could be why the collection seems to disappear with no conscious action on my part to approve the deleting.

    Hope that helps. Otherwise, I can report no other bugs, or weird action of the client.

    P.S. I am using desktop, mac, 5.0.59
  • But there is no standard prompt that you regularly get with delete.
    Not sure what you mean there. There's a confirmation dialog when you go to delete a collection. But if I press Delete immediately after clicking the "New Collection…" button, I am able to trigger the delete prompt before the collection-name prompt appears. The delay between clicking the button and the prompt appearing could also be longer if Zotero was doing something else in the background. I still can't really think of a way the collection could be getting deleted without your pressing the Delete key, but there's at least a period of time during which you could do that and then mistake the confirmation window for the collection-name prompt.

    In any case, the fact that there can be keyboard input before the collection-name prompt appears is certainly a bug in the current implementation, so we'll fix that.
  • @shakyegg: The keyboard input issue when creating a new collection should be fixed in the latest Zotero beta.
  • edited December 27, 2018
    Fortunately, I was able to restore my library from my backups. What happens to me is exactly as described by Riveon. Zotero (Windows) appears to show duplicate collections and subcollections. However, these are not real. If I shutdown and restart Zotero, everything is fine again. I've experienced this several times on different machines with the same library, but I do not know what triggers it. I have a large library with probably several thousand items and PDFs.
  • Hi dstillman, excellent to hear that "there can be keyboard input before the collection-name prompt appears is certainly a bug" wound its way to view and is slated for a fix. That's awesome you found that.

    I think the keyboard input issue is certainly part of it. But like you I am stymied on this troubleshoot.

    I believe I am confident that I've tracked down one issue problem of why at times I can call up the new-collection prompt and not have the keyboard input go in. It's a function of mac OS with the second monitor.

    I have Zotero on my second monitor. So if I have an app active on my main monitor i.e. Outlook and I take my mouse pointer over to the second monitor, hover over a collection and right-click on a collection to create a new collection the new collection prompt will pop up.

    However, if I had NOT clicked first on the Zotero app to activate it, then the keyboard input does not go into the field. So you can hover over Zotero and interact with it on right-click, but the focus of input is not yet on the Zotero app.

    So this obviously has no impact on the delete issue because keyboard strokes are not being recognized by Zotero.

    This leaves me to believe that the problem could be going the other way. Since inevitably, the missing collections are always one of the ones that I had been interacting with in the most recent session, perhaps when I go back to my main monitor at some point, the Zotero app is still accepting keyboard input and I activate a delete while thinking I am working in Outlook. Could be as I usually am going back to Outlook to delete whatever email I had sent myself with the link I needed to snap into Zotero. Still though, I would be sure to have noticed that input I was entering on the main monitor app was not happening.

    I would also notice if a delete prompt was popping up on Zotero on my second monitor (while working on the main). There's no way I could miss that.

    Like I said I'm stymied on this troubleshoot.

    Undo collection delete would be amazing

    Just as good or in conjunction would be perhaps making "cancel" the default on the delete collection prompt as opposed to "delete" being the default. Or not allowing the enter-key to execute a delete and make it a mouse click on the delete button.

    If this last suggestion was implemented it would allow a proper troubleshoot to happen. Since, if collections still get deleted mysteriously after removing the default enter-key to execute a delete, then we'd know that there is another pernicious bug somewhere.

    Thanks for working on this. I simply love Zotero and you folks for making it happen.



  • I've also done this multiple times in the last year (at least 4). I click an item in a collection to delete (or think I have), press delete and confirm, and the whole collection goes. It may just be that despite seeming to click an item, the item hasn't actually been selected, so the delete command applies to the whole collection - but the confirmation question looks superficially the same as for an item and when adding and deleting multiple entries it's very easy to press confirm without carefully reading the question carefully each time.
  • Dear Zotero, please, please fix the problem that a collection can be easily deleted. Our important work is saved in these collections and I can't believe I just accidentially deleted a collection. Please, please change this.
  • It is likely that you deleted the collection without deleting the records it contained. Unintentionally deleting the collection organization is certainly very inconvenient but you need to actively accept multiple warnings to delete the contents of a collection. Even then, the contents should remain in your trash.

    It is possible that the most recent automatic backup may be a database version that still contains your collection.
  • edited July 24, 2019
    I have just experienced this issue. I attempted to delete a single item, and did not notice the collection itself was actually selected, since the dialogue boxes are practically identical and I'm frequently deleting items.

    Now zotero is advising the only solution is to chase down sqlite files and "hack" them back in?

    How is there not just a simple Undo function for such an easy mistake?
  • I have no words to thank you, @rickus !!! Your suggestion (comment from 9 September 2016) worked perfectly for me! Just saved me years of work - loosing the way objects were organised in collections would be just as bad as losing the objects themselves.

    Bottonline advice: when collections appear to have been duplicated out of nowhere DO NOT DELETE THEM!

    In more detail: I was using Zotero as usual, when I suddenly noticed that some of my collections appeared to be duplicated. After checking they were really duplicates, I erased one of the verstions. To my utter surprise, the remaining versions started to look weird so I restarted Zotero, only to find out those collections all disappeared! Not only the version that I deleted, but both of them! If this is a bug, please fix it!!!

    P.S. Created this account just to say thanks!!!
  • A thread that goes back some years and it is still relevant today (2020-March 19). I pressed the DEL button, and accidently deleted a collection rather than a single entry. As others have noted there is nothing in trash, CTRL Z does not work etc.

    For the first time, there was NO dialog, "do you want to etc." it just suddenly deleted. Up to now this had worked flawlessly, so I cannot really repeat this. Nor was Zotero busy, it seems to me, doing much. All I can say is the that little dialog box on deleting a collection simply never appeared......
  • @HughD:
    For the first time, there was NO dialog, "do you want to etc." it just suddenly deleted.
    That's just not really possible. The code to delete the collection can't run without the box appearing. If you somehow accidentally pressed Enter at the same time, that could do it.

    Before closing Zotero, make a backup of the zotero.sqlite* files in your Zotero data directory, and then find an item that was in the collection and check for collections containing the item. If you don't find the collection elsewhere in your library (from moving it accidentally), you can try restoring the collection from one of your last automatic backups.
  • Maybe thanks for the reply, as you say I must have accidentally pressed return, it is beside delete on my keyboard. I think I'll stick to the mouse in future.

    I always make a daily local back up of Zotero and had just done so, so nothing was lost, just a little heart attack :-) The instructions to restore a Zotero library from a local backup are pretty clear...
  • JUst had this probleme, the solution i made and worked thankfuly is to rename the file "zotero.sqlite" to "zotero.sqlit_x" for example and rename "zotero.sqlite_bak" to "zotero.sqlite" to replace the newer one by the oldest one simply.
    I would like to send a note to the team ''put an UNDO option, i don't understand why there is a cycle bin ".
  • We're working on undo functionality for collection deletions, which should be available soon.
    @dstillman, any progress with undo delete collection? Or somehow deleted collections appearing in the trash?
  • While I would also very much (from hurtful experience...) appreciate a Ctrl+Z feature for this I found a helpful workaround for my case:

    I always put my references in a single library when I import them as I tend to just search over the whole library anyways when I need them. This means that after I deleted a collection, all the works that were in that collection ended up in "entries without a collection". So I just made a new collection of the same name as the old one and could just drag and drop everything back.
  • Here it is May 2021, and we still can't restore accidentally deleted collection labels. I did the method @rickus suggested, which worked. Unfortunately, I had saved sources that weren't in the backup (too new I suppose). Fortunately, they were in the "unfiled items" and I just added them back to the "new" collection.
Sign In or Register to comment.