Bug Report: Editor updating non existing card

This causes a few steps to trigger:

  1. Open the reviewer
  2. Open the EditCurrent
  3. Open the browser
  4. Delete the current card in the browser
  5. Close the EditCurrent

This gives me the following exception:

Caught exception:
Traceback (most recent call last):
  File "aqt/webview.py", line 493, in handler
  File "aqt/editor.py", line 485, in <lambda>
  File "aqt/editcurrent.py", line 72, in _saveAndClose
  File "aqt/main.py", line 646, in moveToState
  File "aqt/main.py", line 668, in _reviewState
  File "aqt/reviewer.py", line 65, in show
  File "aqt/reviewer.py", line 118, in nextCard
  File "aqt/reviewer.py", line 183, in _showQuestion
  File "anki/cards.py", line 113, in question
  File "anki/cards.py", line 132, in render_output
  File "anki/template.py", line 115, in from_existing_card
  File "anki/cards.py", line 142, in note
  File "anki/collection.py", line 309, in getNote
  File "anki/notes.py", line 34, in __init__
  File "anki/notes.py", line 40, in load
  File "anki/rsbackend_gen.py", line 350, in get_note
  File "anki/rsbackend.py", line 265, in _run_command

You can only escape it by force closing Anki.

Version 2.1.30 (06a69c25)
Python 3.8.0 Qt 5.14.2 PyQt 5.14.2
macOS Catalina 10.15.5 (19F101)

I think the issue is:

  1. EditCurrent pushes its active card onto the reviewers cardQueue
  2. main window calls self.reviewer.show()
  3. show() calls next(), which takes the topmost card from the cardQueue, which was already deleted by the browser
1 Like

Thanks for the report, I’ll look into this.

Did you rule out add-ons? There is logic in the code to account for this already, and I can’t trigger it here.

Hm, I could have sworn I deactivated all add-ons…

However, I tried it again, and I still get a notification to use “Tools > Check Database”, and upon that I get

Deleted ⁨1⁩ card with missing note.

Database rebuilt and optimized.

I can’t reproduce the original issue, but can reproduce that and will fix it in the next update.

(please let me know if the former issue persists after updating)

Okay thanks, and sorry for the inconvenience.

Not a problem, thank you for the report!