[Bug] Delete all cards via changing notetype

On the current main, if you change the notetype of a note, and map all cards to (nothing), it will throw the following error:

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you’ve discovered the add-on that is causing the problem, please report the issue to the add-on author.
Debug info:
Anki 2.1.52 (dev) Python 3.9.7 Qt 6.3.0 PyQt 6.3.0
Platform: Mac 12.3
Flags: frz=False ao=True sv=3
Add-ons, last update check: 2022-05-16 19:04:52

Caught exception:
Traceback (most recent call last):
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/qt/aqt/browser/table/table.py”, line 399, in _on_current_changed
self.browser.on_current_row_changed()
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/qt/aqt/browser/browser.py”, line 488, in on_current_row_changed
self.current_card = self.table.get_current_card()
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/qt/aqt/browser/table/table.py”, line 95, in get_current_card
return self._model.get_card(self._current())
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/qt/aqt/browser/table/model.py”, line 223, in get_card
return self._state.get_card(self.get_item(index))
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/qt/aqt/browser/table/state.py”, line 147, in get_card
return self.col.get_card(CardId(item))
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/pylib/anki/collection.py”, line 410, in get_card
return Card(self, id)
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/pylib/anki/cards.py”, line 60, in init
self.load()
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/pylib/anki/cards.py”, line 68, in load
card = self.col._backend.get_card(self.id)
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/pylib/anki/_backend/generated.py”, line 1800, in get_card
raw_bytes = self._run_command(14, 0, message.SerializeToString())
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/pylib/anki/_backend/init.py”, line 146, in _run_command
raise backend_exception_to_pylib(err)
anki.errors.NotFoundError

Caught exception:
Traceback (most recent call last):
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/qt/aqt/webview.py”, line 563, in handler
cb(val)
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/qt/aqt/editor.py”, line 561, in
self.web.evalWithCallback(“saveNow(%d)” % keepFocus, lambda res: callback())
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/qt/aqt/utils.py”, line 1018, in
self.editor.call_after_note_saved(lambda: func(self, *args, **kwargs))
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/qt/aqt/browser/browser.py”, line 466, in on_all_or_selected_rows_changed
self.card = self.table.get_single_selected_card()
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/qt/aqt/browser/table/table.py”, line 105, in get_single_selected_card
return self._model.get_card(self._selected()[0])
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/qt/aqt/browser/table/model.py”, line 223, in get_card
return self._state.get_card(self.get_item(index))
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/qt/aqt/browser/table/state.py”, line 147, in get_card
return self.col.get_card(CardId(item))
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/pylib/anki/collection.py”, line 410, in get_card
return Card(self, id)
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/pylib/anki/cards.py”, line 60, in init
self.load()
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/pylib/anki/cards.py”, line 68, in load
card = self.col._backend.get_card(self.id)
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/pylib/anki/_backend/generated.py”, line 1800, in get_card
raw_bytes = self._run_command(14, 0, message.SerializeToString())
File “/private/var/tmp/_bazel_hgiesel/d57e06cd6b540154db8fffecc6b9dad9/execroot/ankidesktop/bazel-out/darwin-fastbuild/bin/qt/runanki.runfiles/ankidesktop/pylib/anki/_backend/init.py”, line 146, in _run_command
raise backend_exception_to_pylib(err)
anki.errors.NotFoundError

1 Like