Can't select new note types or make new cards

I recently created a deck using the genanki python package and ever since then I haven’t been able to create any new cards or even select different card types. I get this error every time I’m in a new deck and I select the note type or whenever I go to “Manage Note Types”. I deleted genanki and reinstalled Anki to the last stable build (2.1.23-standard running on MacOS 10.15.5), but the problem still persists. I also did the “Check Database” suggestion in the error but that didn’t work either.

I also tried to look for the python files themselves but with no luck. I looked in /Library/Application Support/Anki2 but I couldn’t find any .py files that matched the names in the Error. I copied and pasted the error below. Any help would be appreciated, thanks!

Error
An error occurred. Please use Tools > Check Database to see if that fixes the problem.
If problems persist, please report the problem on our support site. Please copy and paste the information below into your report.
Anki 2.1.23 (de9543ff) Python 3.8.0 Qt 5.13.1 PyQt 5.14.1
Platform: Mac 10.15.5
Flags: frz=True ao=False sv=1
Add-ons, last update check: 2020-06-17 10:06:58

Caught exception:
Traceback (most recent call last):
File “aqt/modelchooser.py”, line 68, in onModelChange
File “aqt/studydeck.py”, line 59, in init
File “aqt/modelchooser.py”, line 66, in nameFunc
TypeError: ‘<’ not supported between instances of ‘NoneType’ and ‘str’

Please see When problems occur and Getting help

You can also try installing the:

  1. Latest version from https://apps.ankiweb.net/
  2. Latest alternate version from https://apps.ankiweb.net/
  3. If you are felling adventure, you can try installing the latest beta (and alternate beta) versions from https://betas.ankiweb.net/#/

You have put invalid data into your collection - a note type is missing a name. You’ll either need to restore from a backup, or manually edit your collection file to add the missing name to the models column of the col table.

1 Like

I tried restoring from a backup but that didn’t fix the problem, maybe the backup was too recent? Also if I wanted to manually edit the collection file, how would I do that? I tried opening up the .colapkg file into a text editor but it didn’t work. Is there anything specific I have to do when editing the collection file?

So I ended up exporting all of my decks individually and then importing them separately. It was a problem with one of the decks and fortunately it wasn’t too large so I ended up recreating it (I tried importing backups too). My main issue was that I couldn’t even open the “Manage Note Types”, but just wanted to post this to let everyone know how I solved this.

1 Like

@dgorhe can you send me the genanki source code that you used to generate the deck that caused your collection to get corrupted, along with the .apkg file? My email is k@kerrickstaley.com.