Report error

Before the error happened, I was…
[Replace this text.]

Error message (don't change this)
Anki 25.07.5 (7172b2d2) (ao)
Python 3.13.5 Qt 6.9.1 PyQt 6.9.1
Platform: macOS-26.1-arm64-arm-64bit-Mach-O

Traceback (most recent call last):

  File "/Users/kmyles-24/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py", line 3322, in execute_sql
    cursor.execute(sql, params or ())
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^

sqlite3.DatabaseError: database disk image is malformed


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/Users/kmyles-24/Library/Application Support/AnkiProgramFiles/.venv/lib/python3.13/site-packages/aqt/webview.py", line 188, in cmd
    return json.dumps(self.onCmd(str))
                      ~~~~~~~~~~^^^^^

  File "/Users/kmyles-24/Library/Application Support/AnkiProgramFiles/.venv/lib/python3.13/site-packages/aqt/webview.py", line 275, in _onCmd
    return self._onBridgeCmd(str)
           ~~~~~~~~~~~~~~~~~^^^^^

  File "/Users/kmyles-24/Library/Application Support/AnkiProgramFiles/.venv/lib/python3.13/site-packages/aqt/webview.py", line 800, in _onBridgeCmd
    handled, result = gui_hooks.webview_did_receive_js_message(
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        (False, None), cmd, self._bridge_context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^

  File "/Users/kmyles-24/Library/Application Support/AnkiProgramFiles/.venv/lib/python3.13/site-packages/_aqt/hooks.py", line 5543, in __call__
    handled = filter(handled, message, context)

  File "/Users/kmyles-24/Library/Application Support/Anki2/addons21/1322529746/gui/editor.py", line 364, in _on_js_message
    _refresh_buttons(context)
    ~~~~~~~~~~~~~~~~^^^^^^^^^

  File "/Users/kmyles-24/Library/Application Support/Anki2/addons21/1322529746/gui/editor.py", line 286, in _refresh_buttons
    if ah_note := AnkiHubNote.get_or_none(anki_note_id=note.id):
                  ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^

  File "/Users/kmyles-24/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py", line 6845, in get_or_none
    return cls.get(*query, **filters)
           ~~~~~~~^^^^^^^^^^^^^^^^^^^

  File "/Users/kmyles-24/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py", line 6840, in get
    return sq.get()
           ~~~~~~^^

  File "/Users/kmyles-24/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py", line 7297, in get
    return clone.execute(database)[0]
           ~~~~~~~~~~~~~^^^^^^^^^^

  File "/Users/kmyles-24/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py", line 2036, in inner
    return method(self, database, *args, **kwargs)

  File "/Users/kmyles-24/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py", line 2107, in execute
    return self._execute(database)
           ~~~~~~~~~~~~~^^^^^^^^^^

  File "/Users/kmyles-24/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py", line 2280, in _execute
    cursor = database.execute(self)

  File "/Users/kmyles-24/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py", line 3330, in execute
    return self.execute_sql(sql, params)
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^

  File "/Users/kmyles-24/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py", line 3320, in execute_sql
    with __exception_wrapper__:
         ^^^^^^^^^^^^^^^^^^^^^

  File "/Users/kmyles-24/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py", line 3088, in __exit__
    reraise(new_type, new_type(exc_value, *exc_args), traceback)
    ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/Users/kmyles-24/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py", line 196, in reraise
    raise value.with_traceback(tb)

  File "/Users/kmyles-24/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py", line 3322, in execute_sql
    cursor.execute(sql, params or ())
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^

peewee.DatabaseError: database disk image is malformed

Sentry link (for developers)

Hello,

Your AnkiHub database is corrupted. Please follow the steps if you still have the issue:

  1. Close Anki
  2. Go to the ~/Library/Application Support/AnkiHub folder. The Library folder is hidden by default, but can be revealed in Finder by holding down the option key while clicking on the Go menu.
  3. You should see multiple subfolders with random names. Open each subfolder and delete the ankihub.db file.