flxzt/rnote · error · anyhow::Error
bitmapimage does not contain 'image'.
Error message
bitmapimage does not contain 'image'.
What it means
Thrown in TryFrom<RnoteFileMaj0Min13>::try_from when the migration processes a bitmapimage stroke whose object lacks the required 'image' key. The migration must descend into bitmapimage.image.rectangle to convert the legacy transform into an affine matrix, so a missing 'image' key aborts the file upgrade.
Solutions
- Reconstruct the missing 'image' object (with its 'rectangle') in the file JSON from a backup or by re-inserting the bitmap image in the app.
- Restore the note from an earlier backup and re-save it through the app.
- Validate the legacy file against the maj0min13 bitmapimage schema before attempting the migration.
- Patch the migration to report which component index is malformed and skip it rather than failing the whole file.
Example fix
// before: hard failure on missing key
.ok_or(anyhow!("bitmapimage does not contain 'image'."))?
// after: defensive skip in migration
let Some(image) = bitmapimage.get_mut("image") else {
log::warn!("bitmapimage missing 'image'; skipping transform conversion");
return Ok(());
}; Defensive patterns
Strategy: validation
Validate before calling
let bi = &comp["value"]["bitmapimage"];
if bi.is_object() && bi.get("image").is_none() {
return Err("bitmapimage missing 'image'".into());
} Type guard
fn has_image(v: &IValue) -> bool {
v.get("bitmapimage").map_or(false, |b| b.get("image").is_some())
} Try / catch
if let Err(e) = migrate(file) {
if e.to_string().contains("does not contain 'image'") {
// offer backup restore / re-insert image in app
}
} Prevention
- Check bitmapimage.image exists before migrating.
- Avoid truncating JSON when editing files externally.
- Test migrations on copies of real legacy files.
When it happens
Trigger: Migrating maj0min13 -> maj0min15 with stroke_components[*].value.bitmapimage present but no 'image' field inside it.
Common situations: Partially written or truncated legacy files; hand-edited JSON where 'image' was removed; exporters from other tools that omit nested image metadata.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- image does not contain 'rectangle'.
- bitmapimage does not contain 'rectangle'.
- bitmapimage is not a JSON object.
- image is not a JSON object.
- supplied value is not a JSON object.
AI-assisted analysis of flxzt/rnote@bbc5354502 (2026-09-08).
Data as JSON: /api/errors/a15210570ec13822.
Report an issue: GitHub.
Appendix: source
Thrown at crates/rnote-engine/src/fileformats/rnoteformat/maj0min15.rs:94
vectorimage
.as_object_mut()
.ok_or(anyhow!("vectorimage is not a JSON object."))?
.get_mut("rectangle")
.ok_or(anyhow!("vectorimage does not contain 'rectangle'."))?,
)?;
} else if let Some(bitmapimage) = value
.as_object_mut()
.ok_or(anyhow!("value is not a JSON object."))?
.get_mut("bitmapimage")
{
let bitmapimage = bitmapimage
.as_object_mut()
.ok_or(anyhow!("bitmapimage is not a JSON object."))?;
convert_transform_to_affine_in_obj(
bitmapimage
.get_mut("image")
.ok_or(anyhow!("bitmapimage does not contain 'image'."))?
.as_object_mut()
.ok_or(anyhow!("image is not a JSON object."))?
.get_mut("rectangle")
.ok_or(anyhow!("image does not contain 'rectangle'."))?,
)?;
convert_transform_to_affine_in_obj(
bitmapimage
.get_mut("rectangle")
.ok_or(anyhow!("bitmapimage does not contain 'rectangle'."))?,
)?;
}
}
//dbg!(&value);
Ok(Self {
engine_snapshot: value.engine_snapshot,
})View on GitHub (pinned to bbc5354502)