{"record":{"id":"47d90bd91ac8d47c","repo":"flxzt/rnote","slug":"vectorimage-does-not-contain-rectangle","errorCode":null,"errorMessage":"vectorimage does not contain 'rectangle'.","messagePattern":"vectorimage does not contain 'rectangle'\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/rnote-engine/src/fileformats/rnoteformat/maj0min15.rs","lineNumber":80,"sourceCode":"                    convert_transform_to_affine_in_obj(ellipse)?;\n                }\n            } else if let Some(textstroke) = value\n                .as_object_mut()\n                .ok_or(anyhow!(\"value is not a JSON object.\"))?\n                .get_mut(\"textstroke\")\n            {\n                convert_transform_to_affine_in_obj(textstroke)?;\n            } else if let Some(vectorimage) = value\n                .as_object_mut()\n                .ok_or(anyhow!(\"value is not a JSON object.\"))?\n                .get_mut(\"vectorimage\")\n            {\n                convert_transform_to_affine_in_obj(\n                    vectorimage\n                        .as_object_mut()\n                        .ok_or(anyhow!(\"vectorimage is not a JSON object.\"))?\n                        .get_mut(\"rectangle\")\n                        .ok_or(anyhow!(\"vectorimage does not contain 'rectangle'.\"))?,\n                )?;\n            } else if let Some(bitmapimage) = value\n                .as_object_mut()\n                .ok_or(anyhow!(\"value is not a JSON object.\"))?\n                .get_mut(\"bitmapimage\")\n            {\n                let bitmapimage = bitmapimage\n                    .as_object_mut()\n                    .ok_or(anyhow!(\"bitmapimage is not a JSON object.\"))?;\n\n                convert_transform_to_affine_in_obj(\n                    bitmapimage\n                        .get_mut(\"image\")\n                        .ok_or(anyhow!(\"bitmapimage does not contain 'image'.\"))?\n                        .as_object_mut()\n                        .ok_or(anyhow!(\"image is not a JSON object.\"))?\n                        .get_mut(\"rectangle\")\n                        .ok_or(anyhow!(\"image does not contain 'rectangle'.\"))?,","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/flxzt/rnote/blob/bbc5354502ba2fc83eec2670b535348825e679a6/crates/rnote-engine/src/fileformats/rnoteformat/maj0min15.rs#L62-L98","documentation":"Thrown in TryFrom::<RnoteFileMaj0Min13>::try_from during the maj0min13->maj0min15 migration. A vectorimage payload must contain a 'rectangle' entry whose transform is converted to a glam affine; when the key is missing, migration aborts. This means the vector-image stroke data does not conform to the v0.13 schema the migrator expects.","triggerScenarios":"try_from hits a component where value['vectorimage'] is an object but has no 'rectangle' key (renamed, dropped, or replaced by another geometry key).","commonSituations":"Files edited by hand or third-party tools that removed/renamed 'rectangle', or archives corrupted by partial writes.","solutions":["Add a 'rectangle' object (with the 'transform' payload) to the vectorimage entry.","Re-save the file with the originating Rnote version so the schema matches, then retry.","Restore the file from a backup or Rnote's autosave.","If the component is unusable, set its 'value' to null so migration skips it."],"exampleFix":"// before\n{\"vectorimage\": {\"path\": \"...\"}}\n// after\n{\"vectorimage\": {\"path\": \"...\", \"rectangle\": {\"transform\": {\"affine\": [1,0,0,1,0,0,0,0,1]}}}}","handlingStrategy":"validation","validationCode":"fn vectorimage_has_rectangle(comp: &serde_json::Value) -> bool {\n    comp.get(\"value\")\n        .and_then(|v| v.get(\"vectorimage\"))\n        .and_then(|vi| vi.get(\"rectangle\"))\n        .is_some()\n}","typeGuard":"fn get_rectangle<'a>(vectorimage: &'a serde_json::Value) -> Option<&'a serde_json::Map<String, serde_json::Value>> {\n    vectorimage.get(\"rectangle\").and_then(|r| r.as_object())\n}","tryCatchPattern":"match RnoteFileMaj0Min15::try_from(file) {\n    Ok(f) => open(f),\n    Err(e) if e.to_string().contains(\"does not contain 'rectangle'\") => {\n        log::error!(\"vectorimage missing rectangle geometry: {e}\");\n        offer_backup_restore_or_repair();\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Verify each vectorimage entry carries a 'rectangle' key with a transform before migrating.","Never remove or rename 'rectangle' in vectorimage payloads when editing files externally.","Maintain format-version backups so a failed migration can be rolled back."],"tags":["json","migration","schema-validation","file-format"],"backgroundTag":"missing-required-config-field","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"}