{"record":{"id":"c0f662799c0d5e41","repo":"flxzt/rnote","slug":"store-snapshot-has-no-value-chrono-counter","errorCode":null,"errorMessage":"store snapshot has no value `chrono_counter`.","messagePattern":"store snapshot has no value `chrono_counter`\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/rnote-engine/src/fileformats/rnoteformat/maj0min6.rs","lineNumber":41,"sourceCode":"\n        engine_snapshot.insert(String::from(\"document\"), value.document);\n        engine_snapshot.insert(\n            String::from(\"stroke_components\"),\n            store_snapshot\n                .remove(\"stroke_components\")\n                .ok_or_else(|| anyhow!(\"store snapshot has no value `stroke_components`.\"))?,\n        );\n        engine_snapshot.insert(\n            String::from(\"chrono_components\"),\n            store_snapshot\n                .remove(\"chrono_components\")\n                .ok_or_else(|| anyhow!(\"store snapshot has no value `chrono_components`.\"))?,\n        );\n        engine_snapshot.insert(\n            String::from(\"chrono_counter\"),\n            store_snapshot\n                .remove(\"chrono_counter\")\n                .ok_or_else(|| anyhow!(\"store snapshot has no value `chrono_counter`.\"))?,\n        );\n\n        Ok(Self {\n            engine_snapshot: engine_snapshot.into(),\n        })\n    }\n}\n","sourceCodeStart":23,"sourceCodeEnd":49,"githubUrl":"https://github.com/flxzt/rnote/blob/bbc5354502ba2fc83eec2670b535348825e679a6/crates/rnote-engine/src/fileformats/rnoteformat/maj0min6.rs#L23-L49","documentation":"The maj0min5patch9 -> maj0min6 migration requires `store_snapshot.chrono_counter` to exist, as it becomes `engine_snapshot.chrono_counter` in the new format. This error is thrown when that key is missing from the store snapshot object after the previous keys were removed successfully.","triggerScenarios":"Running `RnoteFileMaj0Min6::try_from` on a file whose store snapshot contains `stroke_components` and `chrono_components` but no `chrono_counter` key.","commonSituations":"Files hand-edited with the counter removed, corruption during save, or files from a fork that did not track the chrono counter.","solutions":["Inspect the extracted JSON and add `\"chrono_counter\": 0` (or the appropriate integer) to the store snapshot.","Restore the document from a backup or autosave copy.","Re-save the file with the rnote version matching its stored format version.","If migrating many files, pre-process them with a script that inserts a default `chrono_counter` before conversion."],"exampleFix":"// before\n\"store_snapshot\": { \"stroke_components\": [], \"chrono_components\": [] }\n// after\n\"store_snapshot\": { \"stroke_components\": [], \"chrono_components\": [], \"chrono_counter\": 0 }","handlingStrategy":"validation","validationCode":"// validate before migration\nfn has_chrono_counter(doc: &serde_json::Value) -> bool {\n    doc[\"store_snapshot\"].get(\"chrono_counter\").map_or(false, |v| v.is_u64() || v.is_i64())\n}","typeGuard":"fn store_snapshot_has(doc: &serde_json::Value, key: &str) -> bool {\n    doc[\"store_snapshot\"].get(key).is_some()\n}","tryCatchPattern":"match RnoteFileMaj0Min6::try_from(prev) {\n    Ok(migrated) => /* use migrated */,\n    Err(e) if e.to_string().contains(\"no value `chrono_counter`\") => {\n        // insert a default chrono_counter (e.g. 0) and retry\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Always serialize `chrono_counter` with the store snapshot.","Pre-fill default values (0) for missing counters in custom tooling that writes .rnote files.","Validate the full set of required store snapshot keys before migration.","Keep a backup copy before version upgrades."],"tags":["file-format","json","migration","missing-field"],"backgroundTag":"missing-required-config-field","analyzedSha":"bbc5354502ba2fc83eec2670b535348825e679a6","analyzedAt":"2026-09-08T13:20:33.747Z","contentChangedAt":"2026-09-08T13:20:33.747Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}