open-spaced-repetition/fsrs4anki-helper

[BUG] 23.10 SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some(\"malformed JSON\"))", kind: Other }

Closed this issue · 17 comments

23.10 without FSRS scheduling code.
Open stats with Shift+T.

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 23.10 (3394ab02) Python 3.9.15 Qt 6.5.0 PyQt 6.5.0
Platform: Linux-6.5.0-1-amd64-x86_64-with-glibc2.37
Flags: frz=True ao=True sv=3
Add-ons, last update check: 2023-10-21 09:21:15
Add-ons possibly involved: ⁨FSRS4Anki Helper⁩

Caught exception:
Traceback (most recent call last):
  File "aqt.webview", line 46, in cmd
  File "aqt.webview", line 153, in _onCmd
  File "aqt.webview", line 666, in _onBridgeCmd
  File "aqt.toolbar", line 411, in _linkHandler
  File "aqt.toolbar", line 432, in _statsLinkHandler
  File "aqt.main", line 1221, in onStats
  File "aqt", line 130, in open
  File "aqt.stats", line 178, in __init__
  File "aqt.stats", line 224, in refresh
  File "anki.stats", line 112, in report
  File "/home/anki/.local/share/Anki2/addons21/759844606/stats.py", line 91, in todayStats_new
    + get_fsrs_stats(self)
  File "/home/anki/.local/share/Anki2/addons21/759844606/stats.py", line 109, in get_fsrs_stats
    ) = retention_stability_burden(lim)
  File "/home/anki/.local/share/Anki2/addons21/759844606/stats.py", line 26, in retention_stability_burden
    elapse_stability_ivl_list = mw.col.db.all(
  File "anki.dbproxy", line 71, in all
  File "anki.dbproxy", line 65, in _query
  File "anki._backend", line 96, in db_query
  File "anki._backend", line 120, in _db_command
anki.errors.DBError: DbError { info: "SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some(\"malformed JSON\"))", kind: Other }

**Environment**
 - Anki version: Version ⁨23.10rc1 (3394ab02)⁩. Works fine with 2.1.66.
Python 3.9.15 Qt 6.5.0 PyQt 6.5.0
 - OS: Debian GNU/Linux
 - addon updated today, mentioned 2023-10-20.

Could you share the affected deck file with me? It seems a problem related to the database of Anki.

I can't share the whole deck, but I moved the cards from one of the affected subdecks into new deeper subdecks and back, and the problem doesn't affect that subdeck and its immediate parent any more.

So what can I do for you? Without the affected card, I can't debug the error.

Will reopen if moving doesn't fix the problem and I find the card.

Rescheduling works, but Disperse siblings causes the same error.

Rescheduling works, but Disperse siblings causes the same error.

Does rescheduling all card cause this error?

No, rescheduling all cards works.

The specific output is


Flags: frz=True ao=True sv=3
Add-ons, last update check: 2023-10-24 00:22:46
Add-ons possibly involved: ⁨FSRS4Anki Helper⁩

Caught exception:
Traceback (most recent call last):
  File "aqt.taskman", line 138, in _on_closures_pending
  File "aqt.taskman", line 82, in <lambda>
  File "/home/anki/.local/share/Anki2/addons21/759844606/schedule/disperse_siblings.py", line 151, in on_done
    tooltip(f"{future.result()} in {time.time() - start_time:.2f} seconds")
  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 "/home/anki/.local/share/Anki2/addons21/759844606/schedule/disperse_siblings.py", line 156, in <lambda>
    lambda: disperse_siblings_backgroud(
  File "/home/anki/.local/share/Anki2/addons21/759844606/schedule/disperse_siblings.py", line 174, in disperse_siblings_backgroud
    nid_siblings = get_siblings(did, filter_flag, filtered_nid_string)
  File "/home/anki/.local/share/Anki2/addons21/759844606/schedule/disperse_siblings.py", line 22, in get_siblings
    siblings = mw.col.db.all(
  File "anki.dbproxy", line 71, in all
  File "anki.dbproxy", line 65, in _query
  File "anki._backend", line 96, in db_query
  File "anki._backend", line 120, in _db_command
anki.errors.DBError: DbError { info: "SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some(\"malformed JSON\"))", kind: Other }

Could you send your collection file to me?

Maybe I could send it (without the text) to Damien and he could send it to you?

My email address is jarrett.ye@outlook.com. Why not send the file to me directly?

I don't want my e-mail service to see it.

If you are so worried about privacy, you can export your collection with blanked-out fields. To do this, go through the following steps:

  • Take a backup by going to File → Create Backup just in case anything goes wrong.
  • Go to Browse > Notes > Find and Replace.
  • Type (.|\n)* in the "Find" field and keep the "Replace With" field empty.
  • Check (✓) the "Treat input as regular expression" option. Uncheck "Selected notes only" if you want to apply this to all notes.

    image

  • Export your collection.
  • Restore the contents of your notes by going to Edit → Undo Find and Replace.

I'd say review times and possibly note types are sensitive, too.

Restore the contents of your notes by going to Edit → Undo Find and Replace.

That seems risky, I do it in a separate profile. Also, IIRC, you need to do it with tags separately.

@LeonardoDEJE, could you share your collection file with me?

Check (✓) the "Treat input as regular expression" option. Uncheck "Selected notes only" if you want to apply this to all notes.

And ".*" is enough to replace everything, no need for \n.

I haven't received any affected collections for debugging, so this issue will be pending.