{"record":{"id":"65c6cba809c87a7b","repo":"flxzt/rnote","slug":"failed-to-load-rnote-file-from-bytes-unsupported","errorCode":null,"errorMessage":"failed to load rnote file from bytes, unsupported version: {}.","messagePattern":"failed to load rnote file from bytes, unsupported version: (.+?)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/rnote-engine/src/fileformats/rnoteformat/mod.rs","lineNumber":153,"sourceCode":"                .and_then(RnoteFileMaj0Min6::try_from)\n                .and_then(RnoteFileMaj0Min9::try_from)\n                .and_then(RnoteFileMaj0Min13::try_from)\n                .and_then(RnoteFileMaj0Min15::try_from)\n                .context(\"converting RnoteFileMaj0Min5Patch9 to newest file version failed.\")\n        } else if semver::VersionReq::parse(\">=0.5.0\")\n            .unwrap()\n            .matches(&wrapper.version)\n        {\n            ijson::from_value::<RnoteFileMaj0Min5Patch8>(&wrapper.data)\n                .context(\"deserializing RnoteFileMaj0Min5Patch8 failed\")\n                .and_then(RnoteFileMaj0Min5Patch9::try_from)\n                .and_then(RnoteFileMaj0Min6::try_from)\n                .and_then(RnoteFileMaj0Min9::try_from)\n                .and_then(RnoteFileMaj0Min13::try_from)\n                .and_then(RnoteFileMaj0Min15::try_from)\n                .context(\"converting RnoteFileMaj0Min5Patch8 to newest file version failed.\")\n        } else {\n            Err(anyhow::anyhow!(\n                \"failed to load rnote file from bytes, unsupported version: {}.\",\n                wrapper.version\n            ))\n        }\n    }\n}\n\nimpl FileFormatSaver for RnoteFile {\n    fn save_as_bytes(&self, _file_name: &str) -> anyhow::Result<Vec<u8>> {\n        let wrapper = RnotefileWrapper {\n            version: semver::Version::parse(Self::SEMVER).unwrap(),\n            data: ijson::to_value(self).context(\"converting RnoteFile to JSON value failed.\")?,\n        };\n        let compressed = compress_to_gzip(\n            &serde_json::to_vec(&wrapper).context(\"Serializing RnoteFileWrapper failed.\")?,\n        )\n        .context(\"compressing bytes failed.\")?;\n","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/flxzt/rnote/blob/bbc5354502ba2fc83eec2670b535348825e679a6/crates/rnote-engine/src/fileformats/rnoteformat/mod.rs#L135-L171","documentation":"Rnote failed to load an .rnote file because the file's version field is not one of the supported major-0 versions (0.5 patch 8 through 0.15). load_from_bytes only supports versions for which conversion chains (RnoteFileMaj0Min5Patch8 -> ... -> newest) exist; anything else is rejected.","triggerScenarios":"Calling RnoteFile::load_from_bytes (via RnoteFileMaj0Min5Patch8::load_from_bytes and_then chain) with bytes whose wrapper.version is a version string outside the supported set, e.g. a file saved by a newer Rnote release.","commonSituations":"Opening an .rnote file written by a newer app version with an older binary; a corrupted or hand-edited file whose 'version' attribute was changed; importing a file from a fork with its own versioning.","solutions":["Update the rnote app/engine to the version matching (or newer than) the file's version","Check the file's version attribute in the zip's document metadata and confirm it matches a supported release (0.5.x - 0.15.x)","Re-save the file with a compatible version of the app","Verify the file is a genuine .rnote archive and not truncated/corrupted"],"exampleFix":"// before (unsupported newer file)\nlet file = RnoteFile::load_from_bytes(&bytes)?;\n// after: check version support first and inform user to upgrade\nif !rnoteversion_is_supported(&file_version) {\n    anyhow::bail!(\"Please update the app to open this file (version {})\", file_version);\n}","handlingStrategy":"try-catch","validationCode":"// Before loading, inspect the zip's version attr if possible\nfn is_supported_version(v: &str) -> bool {\n    matches!(v, \"0.5.8\" | \"0.6\" | \"0.9\" | \"0.13\" | \"0.15\") // supported majors\n}","typeGuard":null,"tryCatchPattern":"match RnoteFile::load_from_bytes(&bytes) {\n    Err(e) if e.to_string().contains(\"unsupported version\") => {\n        eprintln!(\"File was saved by a newer Rnote version; please update the app.\");\n    }\n    Err(e) => return Err(e),\n    Ok(f) => Ok(f),\n}","preventionTips":["Keep the app updated to at least the version that wrote the file","Reject or warn on files whose version string is newer than the engine's supported set","Log the raw version value to ease triage"],"tags":["file-formats","versioning","backward-compatibility","rust"],"backgroundTag":"unsupported-operation","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"}