Repeated loss of an unknown number of cards | Can I compare old backup decks to current versions?

Hello, dear fellow Users.

I have been experiencing problems with Anki for many months now. However, they just disappeared after a while or when I exported and reimported my collection.

Though, I have recently noticed that I have reportedly lost cards without accidentally deleting them (!), as I already did a couple of months ago. I have old backups, but since I do not know which and how many cards I lost, I do not know what I need to retrieve. Only some cards that I have clear memory of and positively know I have lost is what I can restore. Is there a way to compare an old collection to my current one to discover which cards have disappeared?

After (literally!) thousands of hours of work put into my decks for a very important and very difficult exam that I must prepare for 18 months (German first law exam), it is particularly painful for me to loose cards that might be essential for me scoring a good mark.

Most of the time, it says my collection is damaged. As I said, usually a quick export and reimport solved the issue. However, recently, I got the failure message enclosed, after I tried to create a card, Anki bugged and shut itself down, sending that text to me. Today, Anki refused to sync for a couple of times, but this then disappeared.

I am using Thomas Kahn’s German law forms and his Butler addon ( Anyhow, the problems also occur when I start Anki holding shift key, thus disabling the addons.

PLEASE help me, my exam marks determine my future career and life, I really can’t afford to loose any work put into my collection.

> Anki 2.1.33 (3f403040) Python 3.8.0 Qt 5.14.1 PyQt 5.14.1
> Platform: Windows 10
> Flags: frz=True ao=True sv=1
> Add-ons, last update check: 2020-09-07 14:24:08
> Caught exception:
> Traceback (most recent call last):
>   File "aqt\", line 87, in _on_closures_pending
>   File "aqt\", line 59, in <lambda>
>   File "aqt\", line 76, in wrapped_done
>   File "aqt\", line 113, in on_future_done
>   File "aqt\", line 911, in on_collection_sync_finished
>   File "aqt\", line 697, in reset
>   File "aqt\", line 2488, in _call_
>   File "aqt\", line 128, in onReset
>   File "aqt\", line 105, in redraw
> RuntimeError: wrapped C/C++ object of type QListWidget has been deleted

The error message you’ve pasted looks like a bug, but not one I’d expect to be related to losing any data. It seems to be connected to the Study Deck option in the menubar - maybe you had this window open while syncing or shortly prior to it?

If you’re receiving a message that your collection is corrupt, have you tried the Check Database option? If that reports the collection is corrupt as well, that seems to imply something is going on with your hard disk or your computer if it’s repeatedly occurring.

1 Like

The data loss would not be so bad if I had some kind of option to compare my current collection to an old one. That would help me restore lost cards.

I agree that the bug is probably not affiliated to my data loss, especially since data loss had occured long before this error message was sent to me just one month ago. Usually, I have the study deck window open all the time, so if you say it might be related, this might explain it.

I do not remember if I checked the database option when my collection was marked as corrupt, but currently the database seems is fine. These problems however also occured on my old PC (Lenovo Thinkpad X230) and do now too on my X250, so I doubt that it is a hardware problem.

Yesterdays sync fail is now reappearing, it reads: “Please use ‘check database’ and sync afterwards. If the problem persists, please force a full sync through the settings.”

This problem will probably disappear in a few minutes (as it did yesterday) but is still very annoying because it temporarily doesn’t allow me to sync.

Also I don’t know where to “force a fill sync”. Any ideas?

No idea how to really help you, as there is likely some strange corruption going on with your database.

For forcing a full-sync, go into the preferences of Anki, and under the tab “Network”, you can select “On next sync, force changes in one direction”.

I’m not sure how good this works, but maybe a CSV export and reimport on a separate testing profile can show you which cards where newly imported and thus your corruption. The data of creation will differ for newly imported stuff, also, it should show you the identical cards upon importing. Obviously only works if you do not use too many notetypes and if they aren’t too complex.

1 Like

Thank you. I forced the full-sync and the sync failure disappeared.

It gave me a failure warning that my Ankiweb database and local database where in a state that syncing wasn’t possible and that I had to overwrite one of them. This is in line with another random error that I have been experiencing over a year now. I have done a dozen overwriting or so, but the cards that have disappeared are very old cards and are thus part of all old backups, so this does not explain why they got deleted.

I just googled CSV and found this: Sounds promising, but it sounds complicated (for me) and I have to ask one of my computer scientist friends for help. I’ll let you know how it worked out.

I still believe and agree that my database seems to have a strange corrupution that keeps causing trouble every other months or so.

If you have a backup, you can export your current collection, import it into a new profile, and then import the backup - any files in the backup that are missing in the current profile should get imported unless the note type has changed.

1 Like

I have a backup and manually exported collections (manual backups) - I have even found the missing card in a June backup. Some time in June, it got deleted.

I did as you said, doesn’t work. If I try to import the backup, it says that it will overwrite the current collection and replace with the backup. A completion of the missing cards thus does not seem to be possible.

EDIT: I created a manual backup before proceeding. When I overwrote my current collection with the June collection and then put the current one back up, Anki AGAIN told me the online version and current version were not compatible (thus cannot sync) and that I had to choose one of the two, although they were exactly the same.

You can rename a backup from colpkg to apkg to have it imported like a shared deck. Another option is to import it into a new profile, then export it to a text file. Opening a backup will force a full sync regardless of the contents of the backup.

1 Like

I’ll try to do the renaming and importing thing, but do you know what happens if existing cards have been modified? I update and expand my cards literally every day, so I fear that Anki will overwrite them or fail to recognize that they are the same and copy countless old versions into my decks, leaving me with a pile of deletion work.

CSV comparison has not worked so far, although my computer scientist friend tried to help me. CSV will only extract 2500 of my 7000 cards in the first place which is already irritating. Also, I googled how to replace existing rows through Excel, but it tells me that they are the same (while the are not).

You can (and should!) do all of your experimentation on a different profile so you have no chance of seriously messing up.

1 Like

Anther approach that might help:
Export the deck to a text file.
Load your backup and export that to a text file.

sort both lines the same way

On a Unix/BSD/MacOS system, use comm or diff or sdiff to find the lines that differ and decide which version of those lines to keep. Build a new file that way to re-import.

1 Like

Thank you. This sounds promising. I will try to do this, but then again I don’t know when cards were lost. Thus, I might have to go through multiple old backups and compare them to my current collection to see if a gradual lost has occurred. Sounds like a lengthy task. But still better than nothing.

Last time however, I already tried to do export my collection to a .txt and it would buffer for more than ten minutes. I then lost patience and just created a CSV instead then (which didn’t work after all, as I described above). I’ll let you know if and how it worked out this time the way.