AnkiHub sync - Error message

Before the error happened, I was syncing from AnkiHub, because I knew there was a new note created in a deck I maintain and I wanted to view it on Anki. The new card is not showing up in my deck

Error message (don't change this)
Anki 2.1.62 (77dd1dc1) Python 3.9.15 Qt 6.5.0 PyQt 6.5.0
Platform: macOS-11.7.4-x86_64-i386-64bit
Flags: frz=True ao=True sv=3
Add-ons, last update check: 2023-05-23 13:44:14

Traceback (most recent call last):

  File "/Users/dave/Library/Application Support/Anki2/addons21/1322529746/importing.py", line 324, in _update_or_create_note_inner
    note = aqt.mw.col.get_note(id=NoteId(note_data.anki_nid))

  File "anki.collection", line 527, in get_note

  File "anki.notes", line 49, in __init__

  File "anki.notes", line 55, in load

  File "anki._backend_generated", line 653, in get_note

  File "anki._backend", line 156, in _run_command

anki.errors.NotFoundError: Your database appears to be in an inconsistent state. Please use the Check Database action.


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "anki.notes", line 154, in _field_index

KeyError: 'Sketchy 2'


The above exception was the direct cause of the following exception:


Traceback (most recent call last):

  File "aqt.taskman", line 122, in _on_closures_pending

  File "aqt.taskman", line 71, in <lambda>

  File "aqt.taskman", line 90, in wrapped_done

  File "/Users/dave/Library/Application Support/Anki2/addons21/1322529746/gui/menu.py", line 340, in _on_sync_done
    future.result()

  File "concurrent.futures._base", line 439, in result

  File "concurrent.futures._base", line 391, in __get_result

  File "concurrent.futures.thread", line 58, in run

  File "/Users/dave/Library/Application Support/Anki2/addons21/1322529746/sync.py", line 43, in sync_all_decks_and_media
    self._sync_all_decks()

  File "/Users/dave/Library/Application Support/Anki2/addons21/1322529746/sync.py", line 65, in _sync_all_decks
    should_continue = self._sync_deck(ah_did)

  File "/Users/dave/Library/Application Support/Anki2/addons21/1322529746/sync.py", line 77, in _sync_deck
    result = self._download_updates_for_deck(ankihub_did)

  File "/Users/dave/Library/Application Support/Anki2/addons21/1322529746/sync.py", line 114, in _download_updates_for_deck
    import_result = self._importer.import_ankihub_deck(

  File "/Users/dave/Library/Application Support/Anki2/addons21/1322529746/importing.py", line 101, in import_ankihub_deck
    return self._import_ankihub_deck_inner(

  File "/Users/dave/Library/Application Support/Anki2/addons21/1322529746/importing.py", line 144, in _import_ankihub_deck_inner
    dids = self._import_notes(

  File "/Users/dave/Library/Application Support/Anki2/addons21/1322529746/importing.py", line 190, in _import_notes
    note = self._update_or_create_note(

  File "/Users/dave/Library/Application Support/Anki2/addons21/1322529746/importing.py", line 268, in _update_or_create_note
    note = self._update_or_create_note_inner(

  File "/Users/dave/Library/Application Support/Anki2/addons21/1322529746/importing.py", line 351, in _update_or_create_note_inner
    self.prepare_note(

  File "/Users/dave/Library/Application Support/Anki2/addons21/1322529746/importing.py", line 392, in prepare_note
    changed_fields = self._prepare_fields(

  File "/Users/dave/Library/Application Support/Anki2/addons21/1322529746/importing.py", line 454, in _prepare_fields
    if note[field.name] != field.value:

  File "anki.notes", line 159, in __getitem__

  File "anki.notes", line 156, in _field_index

KeyError: 'Sketchy 2'

Sentry link (for developers)

This happened in the EndeavorOverhaul deck. I approved a new note (note id: 1684335404953) that uses a note type with inconsistent fields to the note type used in the deck, which I think led to this problem. I do not think subscribers will be able to download this new note, and will receive the same error message. However, Because I already approved the note, it exists on the AnkiHub deck and cannot be deleted.

I deleted this note now. You should be able to sync the deck.

This worked. Thank you so much.

1 Like