Unsure of whats going on but this error keeps popping up

The category for general support questions related to using AnkiHub.

Things not to ask about here:

Please include supporting information and documents such as screenshots, recordings, etc.

Anki 24.11 (87ccd24e) (ao)

Python 3.9.18 Qt 6.6.2 PyQt 6.6.1

Platform: macOS-26.3-x86_64-i386-64bit

Traceback (most recent call last):

File “/Users/kazirahman/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 “aqt.taskman”, line 144, in _on_closures_pending

File “aqt.taskman”, line 88, in

File “aqt.taskman”, line 108, in wrapped_done

File “aqt.operations”, line 128, in wrapped_done

File “aqt.reviewer”, line 554, in after_answer

File “aqt.reviewer”, line 567, in _after_answering

File “aqt.reviewer”, line 261, in nextCard

File “aqt.reviewer”, line 404, in _showQuestion

File “_aqt.hooks”, line 4258, in _call_

File “/Users/kazirahman/Library/Application Support/Anki2/addons21/1322529746/gui/reviewer.py”, line 377, in _add_or_refresh_view_note_button

ankihub_nid = ankihub_db.ankihub_nid_for_anki_nid(card.nid)

File “/Users/kazirahman/Library/Application Support/Anki2/addons21/1322529746/db/db.py”, line 362, in ankihub_nid_for_anki_nid

AnkiHubNote.select(AnkiHubNote.ankihub_note_id)

File “/Users/kazirahman/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py”, line 2036, in inner

return method(self, database, *args, **kwargs)

File “/Users/kazirahman/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py”, line 2301, in scalar

row = self.tuples().peek(database)

File “/Users/kazirahman/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py”, line 2036, in inner

return method(self, database, *args, **kwargs)

File “/Users/kazirahman/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py”, line 2286, in peek

rows = self.execute(database)[:n]

File “/Users/kazirahman/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py”, line 2036, in inner

return method(self, database, *args, **kwargs)

File “/Users/kazirahman/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py”, line 2107, in execute

return self._execute(database)

File “/Users/kazirahman/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py”, line 2280, in _execute

cursor = database.execute(self)

File “/Users/kazirahman/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py”, line 3330, in execute

return self.execute_sql(sql, params)

File “/Users/kazirahman/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py”, line 3322, in execute_sql

cursor.execute(sql, params or ())

File “/Users/kazirahman/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/kazirahman/Library/Application Support/Anki2/addons21/1322529746/lib/peewee.py”, line 196, in reraise

raise value.with_traceback(tb)

File “/Users/kazirahman/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

Thinking

Search
Found 0 results for ‘tags:official database disk image is malformed AnkiHub category::person_raising_hand: Support order:latest max_posts:10 status:open’

That error means the AnkiHub local database file is corrupted (not your main Anki collection, but AnkiHub’s own SQLite file).

You can usually fix this by forcing AnkiHub to rebuild its local DB.

1. First, confirm Anki itself is OK

In Anki:

  1. Go to Tools → Check Database and let it run.
  2. If Anki reports corruption in your collection, fix/restore that first (if it reports serious issues, the Anki forum is the best place for help with that).

If Anki’s check is clean, continue with the AnkiHub steps below.


2. Rebuild AnkiHub’s local database

  1. Close Anki completely.

  2. On your Mac, open this folder in Finder:

    /Users/kazirahman/Library/Application Support/Anki2/addons21/1322529746
    
  3. Inside there, look for an AnkiHub database file. Common names are things like:

    • ankihub.db
    • ankihub.sqlite
    • or similar in the db/ subfolder.
  4. Quit Anki if it’s open, then:

    • Move that AnkiHub DB file (or the db folder) somewhere safe outside the Anki folder (e.g. Desktop) as a backup.
    • Don’t delete it yet—just move/rename it.
  5. Start Anki again.

  6. Go to AnkiHub → Log in / Sync and trigger a full sync so AnkiHub can recreate its local database from the server.

If the DB file was the issue, the error should disappear when reviewing and using the “View note on AnkiHub” button.


3. If it still happens

Please reply here with:

  • Whether Tools → Check Database reported any issues.
  • A screenshot of the contents of:
    /Users/kazirahman/Library/Application Support/Anki2/addons21/1322529746
    
    especially any db or .db / .sqlite files.

If you get any new error message after removing the DB and resyncing, paste that traceback as well.

If at any point Anki reports that your main collection.anki2 is corrupted, the safest path is often to restore a backup (from Anki’s automatic backups) and then re‑enable AnkiHub.

Hello,

You are not on the latest version of Anki. You can download it here: https://apps.ankiweb.net/. After downloading, simply run the downloaded file to update your application.

After updating Anki, follow these steps:

  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.
  4. Open Anki

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.