What is the cause of FileTooOld error when importing a deck?

A while ago I made a site that generates Anki decks for Japanese automatically, but lately I have received several reports my users are getting a FileTooOld error when trying to import one of the decks in the more recent versions of the PC desktop client.

A typical error:

Traceback (most recent call last):
  File "aqt\importing.py", line 402, in on_done
  File "concurrent\futures\_base.py", line 432, in result
  File "concurrent\futures\_base.py", line 388, in __get_result
  File "concurrent\futures\thread.py", line 57, in run
  File "lib\site-packages\anki\importing\apkg.py", line 44, in run
  File "lib\site-packages\anki\importing\anki2.py", line 37, in run
  File "lib\site-packages\anki\importing\anki2.py", line 51, in _prepareFiles
  File "lib\site-packages\anki\storage.py", line 50, in Collection
  File "lib\site-packages\anki\rsbackend.py", line 264, in open_collection
  File "lib\site-packages\anki\rsbackend.py", line 257, in _run_command
anki.rsbackend.DBError: DBError { info: "", kind: FileTooOld }

I haven’t been able to find any other info online, but as the decks are generated at the time the user downloads them it isn’t likely to be the file creation date. Any clues what is likely to be causing this?

What is your Anki version?

  1. Can you try installing the latest version available from https://apps.ankiweb.net/
  2. If you are felling adventurous, you can try installing the latest beta version from https://betas.ankiweb.net/#/

This happens because the SCHEMA_MIN_VERSION of your deck uses a old version of the database schema, which is checked by this part of the code:

  1. https://github.com/ankitects/anki/blob/b51f03085e892c03e6f757a43f89e4fc55e0e7dd/rslib/src/storage/sqlite.rs#L146
File: anki/rslib/src/storage/sqlite.rs
145: let err = match ver {
146:     v if v < SCHEMA_MIN_VERSION => Some(DBErrorKind::FileTooOld),
147:     v if v > SCHEMA_MAX_VERSION => Some(DBErrorKind::FileTooNew),
148:     12 | 13 => {
149:         // as schema definition changed, user must perform clean
150:         // shutdown to return to schema 11 prior to running this version
151:         Some(DBErrorKind::FileTooNew)
152:     }
153:     _ => None,
154: };

I just checked a file generated from your website. It loads fine with 2.1.22 and old 2.0.52. I noticed media folder date is 2018 instead of the file generation date. Maybe this plays a role.

Anki’s file format has used schema 11 for 8 years now. If your tool is outputting an older schema, you will need to update it.