«Check database» Explain errors and what is done to fix it

AnkiWeb addon 1135180054

Explains database-check error messages and adds extra integrity checks/fixes for duplicate note cards, missing deck or deck-option parameters, and duplicate note GUIDs, warning users to back up first.
AI-generated summary; may contain mistakes.

duplicatesbackup-maintenancedeveloper-toolsbeta

Open on AnkiWeb GitHub Find alternatives

AnkiWeb

Votes
7 (👍 3 · 👎 4)
Updated
2020-03-07
Anki versions
unknown
License
GPL-3.0 (from the license file in the package)
Virus scan
No ClamAV match A match does not prove malware. No match does not prove that the code is safe.
Languages
Python, JSON, Batchfile
Description language
en

Maintenance

abandoned

  • Last update or commit: 2020-12-26 (2136 days before the snapshot).
  • Commits in the last year: 0.
  • Issues: 3 open, 1 closed.
  • Pull requests: 1 open, 1 merged.
  • Median first response: 4 hours (4 answered issues and pull requests).
  • Outside pull requests: 100% of 1 merged.

Will it work on my Anki?

Version branches
Min AnkiMax AnkiUpdated
2.1.0–2020-03-07
History across monthly snapshots

Loading…

Similar addons

Subdeck Optimization

Adds tags to notes according to their cards' subdecks and can automatically flatten cluttered legacy decks, preserving hierarchy while speeding up Anki.

taggingdeck-management

4 votes 51% approval 👍 4 · 👎 0 ⭐ 0 Anki 2.1.66~ Updated 2025-06-01
AnkiExplain

Adds an Explain button and dockable sidebar that uses Gemini AI to generate flashcard explanations, mnemonics, related concepts, and follow-up chat, with streaming responses and customizable prompts.

aireview-flowshortcutsaccessibility

6 votes 61% approval 👍 6 · 👎 0 Anki 2.1.1~ Updated 2026-02-12

Description

WARNING: This add-on is still in beta mode. It is supposed to Fix the database. However, as anything updating the database, it may actually hurt it if there is a bug not yet found. Hence, be sure to have a backup of your collection before running «Check Database». Rationale This add-on simultaneously solves three related problems. Please read the exact list on github: https://github.com/Arthur-Milchior/anki-database-check-explained

README

Database checker/fixer explained, more fixers

Rationale

This add-on simultaneously solves three related problems.

Meaningful error message

Sometime, Anki warns you that your database has trouble and that you should run «Check Database» to correct it. I find this quite frustrating, because I've no clue what's wrong. Since it may happen many times, I would like to understand what's wrong to avoid repeating the error. This is especially important for add-on developers, because if our add-ons break the database, it would be better to know exactly how it broke, so that we can correct this. Hence, this add-on changes messages sent by the methods used to check and to fix the database, so that they explain exactly what it does.

More information on the error messages can be found on https://github.com/Arthur-Milchior/anki/blob/master/documentation/DB_Check.md

Checking what Anki forgot to check

There are kinds of errors that Anki does not check. This add-on also checks and corrects those kinds of errors. The following error is currently considered:

  • A note has two distinct cards for the same card type. If this is the case, it keeps the card with the greatest interval. Ties are broken by the one with greatest ease, then the one with the greatest due date, then arbitrarily. I explain in the forum how this could occur without having a single add-on installed.
  • Whether there are missing parameters in a deck (standard or dynamic/filtered), or deck option,
  • Whether two notes have the same GUID. See https://github.com/Arthur-Milchior/anki-unique-GUID to understand why this may occur.

Warning

This add-on is incompatible with add-on

  • 12287769 «Explain deletion». This add-on ensures that the file deleted.txt states why notes are deleted.
  • Quicker Anki: 802285486 which makes some operations quicker.

Please instead use-addon 777545149 which merges those three add-ons

With one exception, this add-on does not actually edit the database. All editions are done by Anki original code. The exception is the checks which are done by this add-on and not by Anki. Right now, it's only: checking whether a note has a duplicate card.

Internal

In the class anki.collection._Collection, it changes the methods:

  • basicCheck, a method used thrice during sync to check whether everything is ok or whether there is an inconsistency.
  • fixIntegrity, the method which is used when clicking on "Check Database".
  • _checkFailed. The new method explains the problem comes from the server.

Version 2.0

None

TODO

Use config to allow user to choose to have only one of the two functionality. Allow to choose which card to keep.

Make it compatible with add-on mentioned above.

Links, licence and credits

Key Value
Copyright Arthur Milchior arthur@milchior.fr
Based on Anki code by Damien Elmes anki@ichi2.net
License GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
Source in https://github.com/Arthur-Milchior/anki-database-check-explained
Addon number 1135180054