{"record":{"id":"cbc73edb5c7d188c","repo":"flxzt/rnote","slug":"affine-does-not-have-value-at-index-1","errorCode":null,"errorMessage":"affine does not have value at index 1","messagePattern":"affine does not have value at index 1","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/rnote-engine/src/fileformats/rnoteformat/maj0min15.rs","lineNumber":144,"sourceCode":"        .ok_or(anyhow!(\"transform is not a JSON object.\"))?;\n    let affine = transform\n        .get(\"affine\")\n        .ok_or(anyhow!(\"transform does not contain 'affine'.\"))?\n        .as_array()\n        .ok_or(anyhow!(\"affine not an array.\"))?;\n\n    obj.insert(\n        \"affine\",\n        vec![\n            #[allow(clippy::get_first)]\n            affine\n                .get(0)\n                .cloned()\n                .ok_or(anyhow!(\"affine does not have value at index 0\"))?,\n            affine\n                .get(1)\n                .cloned()\n                .ok_or(anyhow!(\"affine does not have value at index 1\"))?,\n            affine\n                .get(3)\n                .cloned()\n                .ok_or(anyhow!(\"affine does not have value at index 3\"))?,\n            affine\n                .get(4)\n                .cloned()\n                .ok_or(anyhow!(\"affine does not have value at index 4\"))?,\n            affine\n                .get(6)\n                .cloned()\n                .ok_or(anyhow!(\"affine does not have value at index 6\"))?,\n            affine\n                .get(7)\n                .cloned()\n                .ok_or(anyhow!(\"affine does not have value at index 7\"))?,\n        ],\n    );","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/flxzt/rnote/blob/bbc5354502ba2fc83eec2670b535348825e679a6/crates/rnote-engine/src/fileformats/rnoteformat/maj0min15.rs#L126-L162","documentation":"Same migration step as index 81, but the \"affine\" array had a value at index 0 and none at index 1, so it is missing the second matrix element. The conversion reads indexes 0,1,3,4,6,7 and aborts at the first missing one.","triggerScenarios":"An .rnote file whose \"affine\" array has exactly 1 element (or a hole at position 1) when run through the maj0min15 TryFrom conversion.","commonSituations":"Truncated JSON arrays from a partial write or corrupted serialization.","solutions":["Pad or repair the \"affine\" array to contain all 8 values, e.g. [1,0,0,1,0,0,0,1].","Re-export or restore the file from a backup.","Fix the writer to always emit the full matrix."],"exampleFix":"// before\n\"affine\": [0.5]\n// after\n\"affine\": [0.5, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 1.0]","handlingStrategy":"validation","validationCode":"if affine.len() < 8 { return Err(\"affine missing required elements 0,1,3,4,6,7\".into()); }","typeGuard":"fn is_full_affine(a: &serde_json::Value) -> bool {\n    a.as_array().map(|a| a.len() >= 8).unwrap_or(false)\n}","tryCatchPattern":null,"preventionTips":["Validate the full matrix shape, not element-by-element, before migrating.","Restore from backups rather than patching truncated JSON by hand.","Ensure atomic file writes (write temp + rename) to avoid truncation."],"tags":["json","file-migration","index-out-of-range"],"backgroundTag":"index-out-of-bounds","analyzedSha":"bbc5354502ba2fc83eec2670b535348825e679a6","analyzedAt":"2026-09-08T13:20:33.747Z","contentChangedAt":"2026-09-08T13:20:33.747Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}