ck3-save-updater

Checking a save before you load it

lint reads a save and reports, without changing it:

migrate runs the same checks on every output by default, prints them, and writes them next to the output as <name>.lint.json (--no-lint skips them). The predictions depend on which mods will be active: by default the checks assume the Workshop mods the save itself lists (those installed); --mods none on lint, or --lint-mods none on migrate, predicts a load with no mods. Pointing the checks at the game folder (found automatically, or --game-dir) and a save from the current version (--reference) makes them more complete.

ck3update lint "My_Old_Campaign.migrated.ck3" --json "My_Old_Campaign.lint.json"

Options

Option What it does
--reference a save written by the target game version, for the key-name check and the portrait data length; none to skip
--game-dir the game’s game folder (default: $CK3_GAME_DIR or the usual Steam paths)
--target the game version the save will be loaded into, such as 1.21. The default is the installed game’s version, and the save’s own when that can’t be read
--no-keys skip the checks that need game data: key names and what the game will log (the installed game, whichever version it is)
--mods save / --mods none assume the save’s own Workshop mods are active (the default, those installed), or none
--before the save this one was loaded from: use it when the game has re-saved an update’s output. It also runs the land check: titles your realm held there that are held outside your realm here, titles that no longer exist, and people in your realm left with no land (the land check). Report only: the exit code is unchanged
--json write the findings to this JSON file. Each finding lists every item under items, not only the examples the screen shows, so a count can be checked against its list

A check that cannot run, because there is no game folder or reference save to compare against, is listed as skipped rather than passed.

Lint checks a save against the game it will be loaded into, called the target game. That is the version given with --target. Without it, lint takes the installed game’s version. If the installed game’s version can’t be read, it takes the save’s own. Lint’s first lines say which target it used and which reference save it compared with.

A save can be older than the target game. An update for 1.21 writes a save stamped 1.20 on purpose, and the game converts it when it first loads it. Lint says so in one line and checks the save against 1.21. The check of carried fields is the exception. It follows the save’s own version, because the game reads the file in that format before it converts it.

The reference save should be from the target game’s version. If one was found by default and it is from another version, lint sets it aside, says so, and says what it used instead. Comparing with the wrong version reports differences that are only the version’s. A reference you name with --reference is always used, with a warning if its version differs from the target. A copy installed from PyPI has no default reference. It uses one only when you name it or set CK3_REFERENCE_SAVE.

The checks

Each finding is described in plain words first. For what the game will log, the game’s own log wording is the check’s name, so it can be found in the game’s error log.

Errors

Warnings

Information

What the game will log

Each of these is a kind of line the current game writes to its error log, with the predicted number of lines:

Everything but the first two needs the game folder.

Unknown names

Exit codes

Code Meaning
0 done, with no error from the updater itself. The save can still carry thousands of predicted log lines; that is reported, not an error
1 bad input (a missing file, a save the tool cannot read, an unknown or refused rule selection)
2 refused: the output exists, or would overwrite the input
3 the written file failed verification; nothing was written
4 the checks found an error. migrate still writes the output so it can be inspected
5 a patch failed: migrate prints why and writes nothing; check exits 5 when a patch would fail

soak has exit codes of its own; see soak.