Inconsistent number of reviews when clicking `optimize`


Another confusing toast:



Why are they different? I think the first one should be Only 0 review was found.

Can you provide an example apkg which demonstrates the inconsistency?

The ‘insufficient history to perform this operation’ is triggered in other cases such as when there are no learning steps in the review history (get_optimal_retention_parameters())

It could reproduce the second issue. When I search preset:all prop:ivl>100, there is zero card queried.

For the first issue, I guess the computeWeightsProgressString isn’t emptied.

fsrs-rs’s smooth_and_fill may return FSRSError::NotEnoughData, which turns into the 500 error.

I will update the progress code to clear out the old text at the start of an operation.

But the number of reviews is zero, which is less than 1000 reviews. The less than 1000 warning should pop up before smooth_and_fill.

JS error /_anki/pages/deck-options.js:1 Uncaught (in promise) Error: 500: Insufficient review history to perform this operation.
1704685029.276 POST /_anki/computeFsrsWeights
[rslib/src/scheduler/fsrs/] &search = Group(
            Property {
                operator: ">",
                kind: Interval(
[rslib/src/search/] &sql = "select from cards c where (c.did in (1544629910163,1572797501025,1701922603144) and ivl > 100)"
[rslib/src/scheduler/fsrs/] revlogs.len() = 0
[rslib/src/scheduler/fsrs/] fsrs_items = 0
Traceback (most recent call last):
  File "/Users/jarrettye/Codes/anki/qt/aqt/", line 630, in wrapped
    if data := handler():
  File "/Users/jarrettye/Codes/anki/qt/aqt/", line 611, in <lambda>
    return lambda: getattr(, f"{endpoint}_raw")(
  File "/Users/jarrettye/Codes/anki/out/pylib/anki/", line 931, in compute_fsrs_weights_raw
    return self._run_command(11, 27, message)
  File "/Users/jarrettye/Codes/anki/pylib/anki/", line 166, in _run_command
    raise backend_exception_to_pylib(err)
anki.errors.InvalidInput: Insufficient review history to perform this operation.

[rslib/src/scheduler/fsrs/] guard.current() = 0
[rslib/src/scheduler/fsrs/] = 0

I’ve pushed a change that will do the count check at the start.

1 Like

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