{"record":{"id":"2cbd4950409fc757","repo":"flxzt/rnote","slug":"document-is-not-a-json-object","errorCode":null,"errorMessage":"`document` is not a JSON object.","messagePattern":"`document` is not a JSON object\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/rnote-engine/src/fileformats/rnoteformat/maj0min13.rs","lineNumber":25,"sourceCode":"pub struct RnoteFileMaj0Min13 {\n    /// A snapshot of the engine.\n    #[serde(rename = \"engine_snapshot\")]\n    pub engine_snapshot: ijson::IValue,\n}\n\nimpl TryFrom<RnoteFileMaj0Min9> for RnoteFileMaj0Min13 {\n    type Error = anyhow::Error;\n\n    fn try_from(mut value: RnoteFileMaj0Min9) -> Result<Self, Self::Error> {\n        let engine_snapshot = value\n            .engine_snapshot\n            .as_object_mut()\n            .ok_or_else(|| anyhow::anyhow!(\"engine snapshot is not a JSON object.\"))?;\n        let document = engine_snapshot\n            .get_mut(\"document\")\n            .ok_or_else(|| anyhow!(\"`engine_snapshot` has no value `document`.\"))?\n            .as_object_mut()\n            .ok_or_else(|| anyhow!(\"`document` is not a JSON object.\"))?;\n\n        let format = document\n            .remove(\"format\")\n            .ok_or_else(|| anyhow!(\"document has no value `format`.\"))?;\n        let background = document\n            .remove(\"background\")\n            .ok_or_else(|| anyhow!(\"document has no value `background`.\"))?;\n        let layout = document\n            .remove(\"layout\")\n            .ok_or_else(|| anyhow!(\"document has no value `layout`.\"))?;\n        // discard `snap_positions`, this config is now global.\n        document.remove(\"snap_positions\");\n\n        let mut document_config = ijson::IObject::new();\n        document_config.insert(\"format\", format);\n        document_config.insert(\"background\", background);\n        document_config.insert(\"layout\", layout);\n        document.insert(\"config\", document_config);","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/flxzt/rnote/blob/bbc5354502ba2fc83eec2670b535348825e679a6/crates/rnote-engine/src/fileformats/rnoteformat/maj0min13.rs#L7-L43","documentation":"Migration guard in the RnoteFileMaj0Min9 -> RnoteFileMaj0Min13 conversion: the `document` value inside engine_snapshot is not itself a JSON object, so its sub-keys cannot be accessed. Fires on corrupt files where `document` holds a scalar or array instead of an object.","triggerScenarios":"Thrown at crates/rnote-engine/src/fileformats/rnoteformat/maj0min13.rs:25 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Restore from a backup copy; the document node is malformed.","Check the JSON: `document` must be an object containing `format` and `background`.","Re-save from the originating app if possible."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}