Python error in "Check media" and "Check database" feature

Hi,

When I’m trying to use Tools → Check media or Check database, Anki starts to run the check but within a second it reports the following error message:

For Check media:

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue to the add-on author.
Debug info:
Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 6.3.1 PyQt 6.3.1
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2023-01-12 11:22:03

Caught exception:
Traceback (most recent call last):
  File "aqt.taskman", line 122, in _on_closures_pending
  File "aqt.taskman", line 71, in <lambda>
  File "aqt.mediacheck", line 99, in _on_finished
  File "concurrent.futures._base", line 438, in result
  File "concurrent.futures._base", line 390, in __get_result
  File "concurrent.futures.thread", line 52, in run
  File "aqt.mediacheck", line 88, in _check
  File "anki.media", line 171, in check
  File "anki._backend.generated", line 1598, in check_media
  File "anki._backend", line 146, in _run_command
anki.errors.DBError: DbError { info: "", kind: Utf8 }

For Check database:
DbError { info: "FromSqlConversionFailure(7, Text, Utf8Error { valid_up_to: 78, error_len: Some(1) })", kind: Other }

I’m apparently not allowed to post links here, but there’s another forum post from a week ago where at least the second error seems similar - but the topic was not resolved: [Sudden Error Message]

Of course it would be easy to discount this as a broken Anki database file, but then I wonder why I can apparently use it without issues in my daily studying, also creating backups and exports works…

I have a fairly large set of different decks and I probably started using Anki a decade ago, so there might be some legacy stuff that Anki is not good in dealing with.

Any ideas what is the cause and how to fix it?

Thanks and regards,
Fabian

Could you test with 2.1.55 or 2.1.56 (Recommended)

One of the features of 2.1.55 features was: Improve handling of invalid UTF-8 in DB check.

1 Like

Hi,

Thank you for this hint, I had missed these new versions.

I got the same error message when checking media, but then I ran Check database and it fixed the following:

Found <U+2068>922<U+2069> new cards with a due number >= 1,000,000 - consider repositioning them in the Browse screen.
Fixed <U+2068>1<U+2069> review entry with invalid properties.
Fixed <U+2068>1<U+2069> note with invalid utf8 characters.
Database rebuilt and optimized.

Then checking media again, it ran through without problems!

That’s great, thank you for the quick help!

Best regards,
Fabian

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