Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'NoneType' object is not subscriptable #677

Open
sentry-io bot opened this issue Jul 19, 2023 · 0 comments
Open

TypeError: 'NoneType' object is not subscriptable #677

sentry-io bot opened this issue Jul 19, 2023 · 0 comments

Comments

@sentry-io
Copy link

sentry-io bot commented Jul 19, 2023

Sentry Issue: ANKIHUB_ADDON-41C

TypeError: 'NoneType' object is not subscriptable
(7 additional frame(s) were not displayed)
...
  File "1322529746\gui\operations\db_check\anki_db_check.py", line 51, in <lambda>
    lambda: _reset_decks(ah_dids_with_missing_ah_nids),
  File "1322529746\gui\operations\db_check\anki_db_check.py", line 114, in _reset_decks
    reset_local_changes_to_notes(nids, ankihub_deck_uuid=ah_did)
  File "1322529746\reset_local_changes.py", line 34, in reset_local_changes_to_notes
    notes_data = [
  File "1322529746\reset_local_changes.py", line 37, in <listcomp>
    if (note_data := ankihub_db.note_data(nid)) is not None
  File "1322529746\db\db.py", line 305, in note_data
    field["name"] for field in aqt.mw.col.models.get(NotetypeId(mid))["flds"]

The error happens because a note type is missing from the anki database and the code assumes that it exists.
The weird thing is that the note type should exist at this point in the execution, because of this code:
https://github.com/ankipalace/ankihub_addon/blob/2c739cda0c9ee6e14604d5fcc21dcf2f31558397/ankihub/reset_local_changes.py#L24-L32

When looking at the logs of users they say that the missing note type was created before the error happens.

I tried to reproduce the error by installing the AnkiHub deck, removing the IO-one by one (AnKing / AnKingMed) note type and resetting local changes to simulate a situation like in this event: https://ankihub.sentry.io/issues/4253438621/events/5ba8f183d8284cb49b6df56f817680ca/?project=6546414. I didn't get any error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants