flxzt/rnote · error · anyhow::Error
document has no value `background`.
Error message
document has no value `background`.
What it means
Migration guard in the RnoteFileMaj0Min9 -> RnoteFileMaj0Min13 conversion: the `document` object has no `background` key, so the background settings required by the migration are missing. Indicates a truncated or hand-edited .rnote file lacking the background entry.
Solutions
- Restore the file from backup; document.background is missing.
- Add a valid `background` object to the JSON only if you know rnote's background structure.
- Re-save via the originating app version if possible.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/rnote-engine/src/fileformats/rnoteformat/maj0min13.rs:32 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/9d7c930a37207c48.
Report an issue: GitHub.
Appendix: source
Thrown at crates/rnote-engine/src/fileformats/rnoteformat/maj0min13.rs:32
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);
Ok(Self {
engine_snapshot: value.engine_snapshot,
})
}
}
View on GitHub (pinned to bbc5354502)