{"record":{"id":"221ff356d5446a27","repo":"flxzt/rnote","slug":"vectorimage-is-not-a-json-object","errorCode":null,"errorMessage":"vectorimage is not a JSON object.","messagePattern":"vectorimage is not a JSON object\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/rnote-engine/src/fileformats/rnoteformat/maj0min15.rs","lineNumber":78,"sourceCode":"                    .get_mut(\"ellipse\")\n                {\n                    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.\"))?","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/flxzt/rnote/blob/bbc5354502ba2fc83eec2670b535348825e679a6/crates/rnote-engine/src/fileformats/rnoteformat/maj0min15.rs#L60-L96","documentation":"Thrown in TryFrom::<RnoteFileMaj0Min13>::try_from during the maj0min13->maj0min15 migration. When a component's 'value' contains a 'vectorimage' key, that payload must be a JSON object so its 'rectangle' (whose transform is converted to an affine) can be accessed; a non-object vectorimage aborts migration. This indicates malformed vector-image stroke data.","triggerScenarios":"try_from hits a component where value['vectorimage'] exists but is not a JSON object, e.g. vectorimage: \"data\" or vectorimage: [].","commonSituations":"Hand-edited .rnote archives, corrupted files from interrupted writes, or output from an incompatible exporter that serialized vectorimage as a non-object.","solutions":["Make 'vectorimage' an object containing a 'rectangle' entry with the transform.","Re-save the file with the Rnote version that wrote it, then retry migration.","Restore the file from a backup or autosave.","Null the component's 'value' if unrecoverable so the migration skips it."],"exampleFix":"// before\n{\"value\": {\"vectorimage\": \"raw\"}}\n// after\n{\"value\": {\"vectorimage\": {\"rectangle\": {\"transform\": {\"affine\": [1,0,0,1,0,0,0,0,1]}}}}}","handlingStrategy":"validation","validationCode":"fn vectorimage_is_object(comp: &serde_json::Value) -> bool {\n    comp.get(\"value\")\n        .and_then(|v| v.get(\"vectorimage\"))\n        .map_or(true, |vi| vi.is_object())\n}","typeGuard":"fn as_vectorimage_object<'a>(value: &'a serde_json::Value) -> Option<&'a serde_json::Map<String, serde_json::Value>> {\n    value.get(\"vectorimage\").and_then(|v| v.as_object())\n}","tryCatchPattern":"match RnoteFileMaj0Min15::try_from(file) {\n    Ok(f) => open(f),\n    Err(e) if e.to_string().contains(\"vectorimage is not a JSON object\") => {\n        log::error!(\"malformed vectorimage payload: {e}\");\n        restore_from_backup();\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Check vectorimage is an object containing 'rectangle' before migration.","Do not stringify or flatten vectorimage payloads in external tooling.","Validate migrated files by reopening them in Rnote."],"tags":["json","migration","type-mismatch","file-format"],"backgroundTag":"type-mismatch","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"}