flxzt/rnote · error · anyhow::Error
`document` is not a JSON object.
Error message
`document` is not a JSON object.
What it means
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.
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.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/rnote-engine/src/fileformats/rnoteformat/maj0min13.rs:25 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of flxzt/rnote@bbc5354502 (2026-09-08).
Data as JSON: /api/errors/2cbd4950409fc757.
Report an issue: GitHub.
Appendix: source
Thrown at crates/rnote-engine/src/fileformats/rnoteformat/maj0min13.rs:25
pub struct RnoteFileMaj0Min13 {
/// A snapshot of the engine.
#[serde(rename = "engine_snapshot")]
pub engine_snapshot: ijson::IValue,
}
impl TryFrom<RnoteFileMaj0Min9> for RnoteFileMaj0Min13 {
type Error = anyhow::Error;
fn try_from(mut value: RnoteFileMaj0Min9) -> Result<Self, Self::Error> {
let engine_snapshot = value
.engine_snapshot
.as_object_mut()
.ok_or_else(|| anyhow::anyhow!("engine snapshot is not a JSON object."))?;
let document = engine_snapshot
.get_mut("document")
.ok_or_else(|| anyhow!("`engine_snapshot` has no value `document`."))?
.as_object_mut()
.ok_or_else(|| anyhow!("`document` is not a JSON object."))?;
let format = document
.remove("format")
.ok_or_else(|| anyhow!("document has no value `format`."))?;
let background = document
.remove("background")
.ok_or_else(|| anyhow!("document has no value `background`."))?;
let layout = document
.remove("layout")
.ok_or_else(|| anyhow!("document has no value `layout`."))?;
// discard `snap_positions`, this config is now global.
document.remove("snap_positions");
let mut document_config = ijson::IObject::new();
document_config.insert("format", format);
document_config.insert("background", background);
document_config.insert("layout", layout);
document.insert("config", document_config);View on GitHub (pinned to bbc5354502)