{"record":{"id":"04e0f6ba901f70ae","repo":"flxzt/rnote","slug":"affine-does-not-have-value-at-index-3","errorCode":null,"errorMessage":"affine does not have value at index 3","messagePattern":"affine does not have value at index 3","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/rnote-engine/src/fileformats/rnoteformat/maj0min15.rs","lineNumber":148,"sourceCode":"        .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    );\n\n    Ok(())\n}\n","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/flxzt/rnote/blob/bbc5354502ba2fc83eec2670b535348825e679a6/crates/rnote-engine/src/fileformats/rnoteformat/maj0min15.rs#L130-L166","documentation":"The \"affine\" array is missing element at index 3 (the second column of the first matrix row in row-major order). convert_transform_to_affine_in_obj skips index 2 (implied 0 in the stored representation) but requires 3, and aborts when absent.","triggerScenarios":"An .rnote file with an \"affine\" array of length 2-3 (indexes 0,1 present, 3 missing) during the maj0min15 conversion.","commonSituations":"Partial/truncated file writes, hand edits that removed trailing-but-required elements, or a custom exporter emitting a 3x3's first row only.","solutions":["Extend \"affine\" to the full 8-element form [0,1,3,4,6,7 = a,b,c,d,e,f] e.g. [1,0,0,1,0,0,0,1].","Restore the file from backup or regenerate it.","Fix the producing serializer to emit all 8 matrix values."],"exampleFix":"// before\n\"affine\": [1, 0]\n// after\n\"affine\": [1, 0, 0, 1, 0, 0, 0, 1]","handlingStrategy":"validation","validationCode":"for &i in &[0, 1, 3, 4, 6, 7] {\n    if affine.get(i).is_none() { return Err(format!(\"affine missing index {i}\")); }\n}","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":["Remember the stored layout skips index 2; validate length >= 8 regardless.","Test exporters against a schema fixture before shipping.","Keep the file format documented so custom writers emit all rows."],"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"}