Anki: corrupted database
• 204 words • 1 min • updated
Life is hard. Today, when opening Anki on macOS:
DbError { info: "SqliteFailure(Error { code: DatabaseCorrupt, extended_code: 11 }, Some(\"database disk image is malformed\"))", kind: Other }Database corrupt? What is this, are we in the 2000s? Goodness.
I have automatic backups enabled. For 4 years I haven’t needed them. Today is the day. Never say never!
% ls -lt "$HOME/Library/Application Support/Anki2/Thiago/backups/"
total 234496
-rw-r--r--@ 1 tperrotta staff 3911921 Apr 8 00:12 backup-2026-04-08-00.12.17.colpkg
-rw-r--r--@ 1 tperrotta staff 3911921 Apr 7 00:16 backup-2026-04-07-00.16.26.colpkgI try:
open "$HOME/Library/Application Support/Anki2/Thiago/backups/backup-2026-04-07-00.16.26.colpkg"…but apparently that file is corrupt as well.
I am not particularly worried because I sync my notes to AnkiWeb. Even if the entire local collection were corrupt, my flashcards are in the cloud.
So I decided to simply start from scratch1.
mv ~/Library/Application\ Support/Anki2/Thiago/collection.anki2 ~/Library/Application\ Support/Anki2/Thiago/collection.anki2.corrupt
rm -f ~/Library/Application\ Support/Anki2/Thiago/collection.anki2-shm ~/Library/Application\ Support/Anki2/Thiago/collection.anki2-walThen I open Anki.
It prompts me to download my decks from AnkiWeb.
And now everything works as usual! Last cleanup:
trash ~/Library/Application\ Support/Anki2/Thiago/collection.anki2.corruptNo idea why this has happened. First time. Life goes on.
!next
-
The idea was mine. The decision was mine. The LLM suggested the command on how to do so. I can still self-troubleshoot, mmmkay? ↩︎
Backlinks
- anki: auto-sync (Apr 12, 2026)