Anki on Mac displaying error that database is “corrupt” & “some database disk image is malformed”. All I can think that has caused this is shutting my Mac down using long press of power key, which is all that had changed before receiving the error (I usually sync & close Anki before doing this but perhaps today it had not finished in time).
My Anki Mac is synched to Anki web where everything is still fine. I have downloaded Anki on a family member’s laptop & logged in with my account & downloaded from Anki web & all my cards are fine.
When I ran Tools>Check Database on my laptop after receiving the error message, Anki displays that the database is “rebuilt & optimised”. However, the corruption error immediately comes back up.
I have tried to troubleshoot by attempting to download a previous backup from before the corruption via File>Switch Profile, however when I click on Switch Profile the corruption error message displays & the app freezes & I have to force quit.
I have also tried forcing a one-way sync to download from Anki web, however this has lead to the app being stuck on “Processing” & unresponsive & unable to be quit (quit doesn’t work & force quit does not become an option).
I am at a loss as to what to do… Firstly should I kill Anki from Activity Monitor? Then how do I go about fixing the corruption?
Please please please help!!! I have my veterinary finals coming up in a couple weeks & all my notes are on Anki! Thanks.
Try and go into ~/Library/Application Support/Anki2 finding your collection.anki2 file and re-naming it to something else or deleting it. Then try and sync or restore a backup again.
Thank you (especially for such a speedy reply!). Do you think I should give the force one-way sync more time (it’s had about 20mins) as it still says processing (& on Activity Monitor Anki is being shown to still be using CPU & increasing amounts of Bytes read on Disk) or should I kill it?
I have just done as you suggested. When I opened Anki it said no cards as expected & suggested downloading from Anki web which I did, however the corruption message immediately came up again.
What is the exact wording of the error? Maybe if you know how you can run Anki in the command line and see if it gives you a more specific error in the terminal.
I am not sure I know how to run that on my Mac sorry.
I do have previous back ups in my Anki folder in Library & can locate ones from a time before I think the crash happened - maybe restoring from that rather than Anki web could circumvent the problem? I would lose a few cards but not too bad a loss.
It’s a long shot but maybe you could try and rename the collection.media.db2 file as you did the other file? You can try restoring the backup if you want and it wont affect your Ankiweb until you sync.
When I’ve opened back ups (after doing the file renaming) no corruption error message is displayed (vs how it is immediately displayed after doing restore from Anki web)… but this happens for back ups from all times including recent ones from about 5 mins ago? In order to fully test these changes I then have to confirm sync with Upload to Anki web & so overwrite what is on there which I haven’t tried yet…
I think those errors are irrelevant to your collection.
If things go wrong after you force sync you can use the “Force one way on next sync“ setting to force sync from your family’s computer (It should make you force sync anyway) so it should be ok.
Only other things I can think to mention are that I’m not updated to the very latest Anki version so it asks me if I want to update to 25.02.5. And there is a file called “collection.anki2-wal” in my library too.
Would deleting the Anki app & wiping all files related to it from Library & downloading it again from scratch override the problem? Obviously last resort as would have to configure Add ons etc again but I will do anything at this point!
If that doesn’t work, try updating Anki, It is possible it may cause problems if you on a very very outdated version. If that doesn’t work you can try to re-install Anki, but make sure you don’t accidentally delete your backups in the process.
It’s also worth a shot to just restart your computer if you haven’t already, it sometimes works
I just tried this that you suggested & it seems to have solved the problem! Renamed both this file & the other file, re-opened Anki & restored by downloading from Anki web. No error messages so far! And have created a test card which has synched across web & the other computer all fine…
Fingers crossed that has solved it. Thank you so much for your help & quick replies & trying lots of different methods with me - can’t thank you enough honestly these decks are very important haha!