# Study now comes up with problem, check database deletes cards

**URL:** <https://forums.ankiweb.net/t/study-now-comes-up-with-problem-check-database-deletes-cards/53247>\
**Category:** Help\
**Created:** [December 16, 2024, 10:58am UTC](https://forums.ankiweb.net/t/study-now-comes-up-with-problem-check-database-deletes-cards/53247 "2024-12-16T10:58:51Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![SNH18](https://avatars.discourse-cdn.com/v4/letter/s/f0a364/32.png) [@SNH18](https://forums.ankiweb.net/u/SNH18)\
**Post date:** [December 16, 2024, 10:58am UTC](https://forums.ankiweb.net/t/study-now-comes-up-with-problem-check-database-deletes-cards/53247/1 "2024-12-16T10:58:51Z")

</div>

Hi, I would be grateful for any help.

Before we begin, I would like to say I have searched Anki Forums, followed the trouble shooting steps with no luck. I have manually downloaded a back up and imported to a new user, still the same issue. I have tried to restart the laptop, also no luck.  
In addition, I only use Anki on this one device via the Anki App (I very rarely use anki web and the couple of occasions I have, I ensure a one way sync occurs) and have never had any syncing issues.  
In addition, I create all of my own cards and have never imported a deck from anyhwhere.

Within the last couple of days, I have updated to the latest version of anki (using on MacBook only) after being prompted several times. Version ⁨24.11 (87ccd24e)⁩  
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1. I have copied and pasted the debug info below:

Anki 24.11 (87ccd24e) (ao)  
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1  
Platform: macOS-13.5.2-x86\_64-i386-64bit

===Add-ons (active)===  
(add-on provided name [Add-on folder, installed at, version, is config changed])  
Image Occlusion Enhanced [‘1374772155’, 2022-04-09T08:15, ‘None’, ‘’]

===IDs of active AnkiWeb add-ons===  
1374772155

===Add-ons (inactive)===  
(add-on provided name [Add-on folder, installed at, version, is config changed])

When I go to study one of my decks, it comes up with a notification stating, “Anki encountered a problem. Please follow the troubleshooting steps. The problem may be caused by an add-on” and I am unable to study certain decks due to this. I logged onto Anki Web to see if it is an app issue and the same message appears.  
When I browse a deck, I notice some cards are greyed out (unable to see what the content is or the type of card) and they state, “your database appears to be in an inconsistent state. Please use the check database action. No such card template: X” (X denoting a number). These are the decks I am unable to study at all. I am still able to study other decks not containing any of these greyed-messaged cards.  
For further information, the only add-ons I ever downloaded from the anki website is the image occlusion add-on. This had to be updated a couple of years ago when a new version of anki was downloaded.  
The cloze deletion type of cards I have created have always been created without the need to download an add on from the anki website; previously, it has always been one of the options within the anki app drop down menu when selecting the type of card created.  
I have browsed through all of my cards to try and gauge where the issue may be; from what I can tell, it appears to be affecting all cards where “cloze deletion” has been previously used when creating the cards. I would like to stress that prior to this, I have not had any issues with these types of cards.

I have tried using the check database functions. Although this allows me to study my decks, it states that 100 cards have been deleted. Unfortunately, I am unable to see which cards have been deleted and they are from multiple decks. This is evidently causing some stress as I am approaching med school finals and would be grateful for your help.

Even if there was a way to see which cards are deleted or bring them back, even to a new user on anki, though not ideal, I would be happy with that so I am not losing content as it’s difficult to tell which cards are being deleted through the check database function.

Trouble shooting pages I have already viewed and followed steps for prior to posting this include:

/your-database-appears-to-be-in-an-inconsistent-state-please-use-the-check-database-action-no-such-deck-1723223508553/48550 and /help-deleted-cards/23700 (it does not allow me to post this with the full link contained)

Many Thanks

---

<div class="post-metadata">

**Author:** ![brainravens](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/brainravens/32/23118_2.png) [@brainravens](https://forums.ankiweb.net/u/brainravens)\
**Post date:** [December 16, 2024, 1:38pm UTC](https://forums.ankiweb.net/t/study-now-comes-up-with-problem-check-database-deletes-cards/53247/2 "2024-12-16T13:38:38Z")

</div>

Just to make sure: have you tried disabling the add-on and restarting Anki; does the issue persist?

And/or starting in Safe Mode?

---

<div class="post-metadata">

**Author:** ![SNH18](https://avatars.discourse-cdn.com/v4/letter/s/f0a364/32.png) [@SNH18](https://forums.ankiweb.net/u/SNH18)\
**Post date:** [December 16, 2024, 2:07pm UTC](https://forums.ankiweb.net/t/study-now-comes-up-with-problem-check-database-deletes-cards/53247/3 "2024-12-16T14:07:48Z")

</div>

Hi,

Yes, apologies I forgot to mention I have tried to restart anki in safe mode to disable the add-on but the issue unfortunately does not resolve.

Thank you for pointing this out

---

<div class="post-metadata">

**Author:** ![Anon\_0000](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Anon\_0000](https://forums.ankiweb.net/u/Anon_0000)\
**Post date:** [December 16, 2024, 3:06pm UTC](https://forums.ankiweb.net/t/study-now-comes-up-with-problem-check-database-deletes-cards/53247/4 "2024-12-16T15:06:27Z")

</div>

**Edit:** Nevermind the previous post. Image occlusion and cloze share some code but you probably meant the actual text clozes.

Could you check if downgrading to your previous version makes those decks working again?

---

<div class="post-metadata">

**Author:** ![SNH18](https://avatars.discourse-cdn.com/v4/letter/s/f0a364/32.png) [@SNH18](https://forums.ankiweb.net/u/SNH18)\
**Post date:** [December 16, 2024, 6:01pm UTC](https://forums.ankiweb.net/t/study-now-comes-up-with-problem-check-database-deletes-cards/53247/5 "2024-12-16T18:01:09Z")

</div>

Hi, I have tried downgrading to the previous version after your advice and unfortunately I get the same error message. I also tried opening the downgraded version in safe mode but no luck with this.

Thank you for your suggestion, it helps narrow down the issue

---

<div class="post-metadata">

**Author:** ![Anon\_0000](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Anon\_0000](https://forums.ankiweb.net/u/Anon_0000)\
**Post date:** [December 16, 2024, 6:19pm UTC](https://forums.ankiweb.net/t/study-now-comes-up-with-problem-check-database-deletes-cards/53247/6 "2024-12-16T18:19:08Z")

</div>

So you used the default cloze cards in anki and now those cloze cards don’t work anymore and you get database related issues?

> [@SNH18](#):
>
> No such card template: X”

Do you have a cloze card type if you go to _tools \> manage card types_?  
And did you ever change the cloze back / front [templates](https://docs.ankiweb.net/templates/intro.html)?

---

<div class="post-metadata">

**Author:** ![SNH18](https://avatars.discourse-cdn.com/v4/letter/s/f0a364/32.png) [@SNH18](https://forums.ankiweb.net/u/SNH18)\
**Post date:** [December 16, 2024, 7:44pm UTC](https://forums.ankiweb.net/t/study-now-comes-up-with-problem-check-database-deletes-cards/53247/7 "2024-12-16T19:44:26Z")

</div>

[quote=“Anon\_0000, post:6, topic:53247”]  
So you used the default cloze cards in anki and now those cloze cards don’t work anymore and you get database related issues? [/quote]  
Yes, this is correct

Yes, there is a cloze card type when I go to _tools \> manage card types_.  
I have never changed the cloze back/ front templates, I have also checked this again after your advice, thank you.

I’m not sure how helpful this is, I have copied and pasted the debug info below when the error message appears when I try to study the affected decks:

Anki 24.11 (87ccd24e) (ao)  
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1  
Platform: macOS-13.5.2-x86\_64-i386-64bit

Traceback (most recent call last):  
File “aqt.webview”, line 53, in cmd  
File “aqt.webview”, line 169, in \_onCmd  
File “aqt.webview”, line 725, in \_onBridgeCmd  
File “aqt.overview”, line 98, in \_linkHandler  
File “aqt.main”, line 770, in moveToState  
File “aqt.main”, line 791, in \_reviewState  
File “aqt.reviewer”, line 183, in show  
File “aqt.reviewer”, line 203, in refresh\_if\_needed  
File “aqt.reviewer”, line 261, in nextCard  
File “aqt.reviewer”, line 376, in \_showQuestion  
File “anki.cards”, line 140, in question  
File “anki.cards”, line 156, in render\_output  
File “anki.template”, line 222, in render  
File “anki.template”, line 269, in \_partially\_render  
File “anki.\_backend\_generated”, line 1480, in render\_existing\_card  
File “anki.\_backend”, line 172, in \_run\_command  
anki.errors.InvalidInput: missing template

===Add-ons (active)===  
(add-on provided name [Add-on folder, installed at, version, is config changed])  
Image Occlusion Enhanced [‘1374772155’, 2022-04-09T08:15, ‘None’, ‘’]

===IDs of active AnkiWeb add-ons===  
1374772155

===Add-ons (inactive)===  
(add-on provided name [Add-on folder, installed at, version, is config changed])

---

<div class="post-metadata">

**Author:** ![Anon\_0000](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Anon\_0000](https://forums.ankiweb.net/u/Anon_0000)\
**Post date:** [December 16, 2024, 8:13pm UTC](https://forums.ankiweb.net/t/study-now-comes-up-with-problem-check-database-deletes-cards/53247/8 "2024-12-16T20:13:08Z")

</div>

Well, that’s odd.  
I mean you could go to your anki data folder and look into the sqlite3 database file (`collection.anki2`).

There is a table called _notes_ which shows your notes, e.g.:

 ![db_notes](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/0/7/070c0ab0dfb275e3e35137593744f04241ecfa68.png)

The _mid_ column shows the id of your notetype, found in the _notetype_ table. In this case, the id is `1734378916698` which corresponds to _Lückentext_ (german word for _cloze deletion_).

 ![db_notetypes](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/0/7/074a362d59f8362759248e59512ee11f335b4eab.png)

The fields for that notetype are stored in table _fields_:

 ![db_fields](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/a/6/a63a0cc73ccd40623ae6191f7d562d4f5090fdc2.png)

The blue marked rows correspond to the cloze card (see the id in the first column), second column shows the order in which those fields are ordered (starting from 0), third column shows the name of that field.  
The _templates_ table should have a matching entry, like mine does:

 ![db_templates](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/8/f/8fa7a7f5c599225cae83ed253bc19349e086dddf.png)

Considering you got

> [@SNH18](#):
>
> anki.errors.InvalidInput: missing template

maybe here lies your problem.

In any case, in theory all your cards are still in the database so you could retrieve all info about them. If your database isn’t seriously damaged, that is. Maybe you can check that your entries for the cloze cards looks valid? Keep in mind that your notetype id will probably be different.

---

<div class="post-metadata">

**Author:** ![Anon\_0000](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Anon\_0000](https://forums.ankiweb.net/u/Anon_0000)\
**Post date:** [December 16, 2024, 9:33pm UTC](https://forums.ankiweb.net/t/study-now-comes-up-with-problem-check-database-deletes-cards/53247/9 "2024-12-16T21:33:57Z")

</div>

> [@Anon\_0000](#):
>
> The _templates_ table should have a matching entry, like mine does:
> 
> ![db_templates](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/8/f/8fa7a7f5c599225cae83ed253bc19349e086dddf.png)

I tested it just now. I deleted this blue row from the _templates_ table and now get the same error as you do @SNH18:

> **Error output**
>
> ```auto
> Anki 24.11 (87ccd24e) (ao)
> Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
> Platform: Linux-6.1.0-0.deb11.21-amd64-x86_64-with-glibc2.31
> 
> Traceback (most recent call last):
> File "aqt.webview", line 53, in cmd
> File "aqt.webview", line 169, in _onCmd
> File "aqt.webview", line 725, in _onBridgeCmd
> File "aqt.overview", line 98, in _linkHandler
> File "aqt.main", line 770, in moveToState
> File "aqt.main", line 791, in _reviewState
> File "aqt.reviewer", line 183, in show
> File "aqt.reviewer", line 203, in refresh_if_needed
> File "aqt.reviewer", line 261, in nextCard
> File "aqt.reviewer", line 376, in _showQuestion
> File "anki.cards", line 140, in question
> File "anki.cards", line 156, in render_output
> File "anki.template", line 222, in render
> File "anki.template", line 269, in _partially_render
> File "anki._backend_generated", line 1480, in render_existing_card
> File "anki._backend", line 172, in _run_command
> anki.errors.InvalidInput: missing template
> 
> ===Add-ons (active)===
> (add-on provided name [Add-on folder, installed at, version, is config changed])
> AnkiWebView Inspector ['31746032', 2023-06-27T21:26, 'None', '']
> Image Occlusion Enhanced ['1374772155', 2022-04-09T09:15, 'None', '']
> Review Heatmap ['1771074083', 2022-06-30T03:43, 'None', '']
> Study Time Stats ['1247171202', 2024-02-24T17:59, 'None', '']
> 
> ===IDs of active AnkiWeb add-ons===
> 1247171202 1374772155 1771074083 31746032
> 
> ===Add-ons (inactive)===
> (add-on provided name [Add-on folder, installed at, version, is config changed])
> Advanced Browser ['874215009', 2023-10-21T16:34, 'None', '']
> Syntax Highlighting NG ['566351439', 2024-07-19T11:46, 'None', '']
> 
> ```

Adding that row back in solved it:

```auto
INSERT INTO "main"."templates" ("ntid", "ord", "name", "mtime_secs", "usn", "config") VALUES ('1734378916698', '0', 'Lückentext', '0', '0', X'0a0e7b7b636c6f7a653a546578747d7d12277b7b636c6f7a653a546578747d7d3c62723e0a7b7b52c3bc636b73656974652045787472617d7d4082dab3d8d0b6e1fcb601');

```

You will need the proper id and name of your cloze card. The blob (_config_ column) is important too. This is language dependend though and also depends on whether you had changed anything in the template before. The part with

```auto
X'0a0e7b7b636c6f7a653a546578747d7d12277b7b636c6f7a653a546578747d7d3c62723e0a7b7b52c3bc636b73656974652045787472617d7d4082dab3d8d0b6e1fcb601'

```

shows the hex value of the cloze template.  
I know the correct value for my language (german) because I got the hex like this from a working profile:

```auto
SELECT hex(config) FROM main.templates;

```

Here’s an example of a plain text version of that blob (data):

 ![db_blob_anot](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/9/3/936d7415e459bc491713ff2a33b31046e6504bbb.png)

Of course, your issue could be a different one. But maybe this helps.

---

<div class="post-metadata">

**Author:** ![Danika\_Dakika](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/danika_dakika/32/17815_2.png) [@Danika\_Dakika](https://forums.ankiweb.net/u/Danika_Dakika)\
**Post date:** [December 16, 2024, 9:47pm UTC](https://forums.ankiweb.net/t/study-now-comes-up-with-problem-check-database-deletes-cards/53247/10 "2024-12-16T21:47:47Z")

</div>

I’ll just interject a few general cautions here –

- Don’t edit or manipulate your database directly unless you know what you’re doing
- Don’t edit your database while Anki is running
- Make a backup before you try anything [File \> Create Backup]
- Make a _copy_ of your database to make your changes so that you still have your original

//end public service announcement

---

<div class="post-metadata">

**Author:** ![Anon\_0000](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Anon\_0000](https://forums.ankiweb.net/u/Anon_0000)\
**Post date:** [December 16, 2024, 9:48pm UTC](https://forums.ankiweb.net/t/study-now-comes-up-with-problem-check-database-deletes-cards/53247/11 "2024-12-16T21:48:36Z")

</div>

True, should have mentioned those. Thanks 👍

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [January 15, 2025, 9:48pm UTC](https://forums.ankiweb.net/t/study-now-comes-up-with-problem-check-database-deletes-cards/53247/12 "2025-01-15T21:48:58Z")

</div>

Closed on January 15, 2025, 9:48pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
