FSRS Simulator crashes Anki if no history

If the simulator is ran on a preset with no history (or all suspended), it gets stuck on “processing…”. If you leave and try to do anything with Anki, it crashes.

In the console, this message is displayed multiple times per second while running:
DEBUG:aqt.mediasrv: POST /_anki/latestProgress

If you wait a couple minutes it displays the popup. After hitting OK it keeps popping until I force quit Anki:
Error: 404: Invalid path: _anki/latestProgress

If I add in a deck with history (enough to optimize), it works fine. If I suspend all the cards in this deck, it no longer works again.

It would be nice if you can schedule fresh presets but if it’s not possible it should work similarly to optimize on low reviews.

Anki 24.06.3 (dc0d1ad7) (src) (ao)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: Linux-5.19.0-40-generic-x86_64-with-glibc2.35

Traceback (most recent call last):
  File "/home/q/src/anki/qt/aqt/taskman.py", line 144, in _on_closures_pending
    closure()
  File "/home/q/src/anki/qt/aqt/taskman.py", line 88, in <lambda>
    lambda future: self.run_on_main(lambda: on_done(future))
  File "/home/q/src/anki/qt/aqt/taskman.py", line 108, in wrapped_done
    on_done(fut)
  File "/home/q/src/anki/qt/aqt/operations/__init__.py", line 259, in wrapped_done
    future.result()
  File "/home/q/src/anki/out/extracted/python/lib/python3.9/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/home/q/src/anki/out/extracted/python/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
    raise self._exception
  File "/home/q/src/anki/out/extracted/python/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/q/src/anki/qt/aqt/operations/__init__.py", line 243, in wrapped_op
    return self._op(mw.col)
  File "/home/q/src/anki/qt/aqt/main.py", line 1502, in backup
    return col.create_backup(
  File "/home/q/src/anki/pylib/anki/collection.py", line 341, in create_backup
    created = self._backend.create_backup(
  File "/home/q/src/anki/out/pylib/anki/_backend_generated.py", line 172, in create_backup
    raw_bytes = self._run_command(3, 2, message.SerializeToString())
  File "/home/q/src/anki/pylib/anki/_backend.py", line 161, in _run_command
    return self._backend.command(service, method, input)
pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: PoisonError { .. }
1 Like

Thanks for this report! I have reproduced this bug just now. The cause is the number of existing cards is zero when you suspend all cards and the default value of additional new cards to simulate is zero. It means there is zero card during simulation which induces this error.

I will fix it soon.

@dae, should we define a new kind of err to handle it?

I thought this simulated the rest of the cards in your deck? Using it with my other decks seems to coincide with that. Also, when I try to use “Additional new cards to simulate”, it still has the same behavior. This is on the preset fresh deck/preset with no reviews.

Oops. I find out a new bug. The simulator is unable to correctly estimate the rating distribution because there is no available data.

1 Like

Should I be able to test with this branch? I updated the Cargo.toml to:

[workspace.dependencies.fsrs]
version = “1.2.1”
git = “GitHub - open-spaced-repetition/fsrs-rs: FSRS for Rust, including Optimizer and Scheduler
rev = “c0b67cc”

But there are build errors in rust.

I introduce a new type of Error, so we need to update some code in Anki’s part.

It will be fixed in

2 Likes