flxzt/rnote · error · anyhow::Error

affine does not have value at index 6

Error message

affine does not have value at index 6

What it means

Index guard in convert_transform_to_affine_in_obj: .get(6) on the affine array returned None, i.e. the stored transform lacks the final component needed for the affine reconstruction during the maj0min15 migration. Indicates truncated transform data in the file being converted.

Solutions

  1. Append the missing translation elements so "affine" has all 8 values, e.g. [..., 0.0, 1.0].
  2. Restore the file from backup or re-export.
  3. Fix the generating code to include the full 8-element matrix.

Example fix

// before
"affine": [1, 0, 0, 1]
// after
"affine": [1, 0, 0, 1, 0, 0, 0, 1]
Defensive patterns

Strategy: validation

Validate before calling

if affine.len() < 8 { return Err("affine missing translation row".into()); }

Type guard

fn is_full_affine(a: &serde_json::Value) -> bool {
    a.as_array().map(|a| a.len() >= 8).unwrap_or(false)
}

Prevention

When it happens

Trigger: An .rnote file with an "affine" array of length 4-5 (missing indexes 6,7) during the maj0min15 conversion.

Common situations: Truncated files, or exporters that emit only the linear part of the matrix without the translation row.

Related errors


AI-assisted analysis of flxzt/rnote@bbc5354502 (2026-09-08). Data as JSON: /api/errors/4b2936923d6fee47. Report an issue: GitHub.

Appendix: source

Thrown at crates/rnote-engine/src/fileformats/rnoteformat/maj0min15.rs:156

                .get(0)
                .cloned()
                .ok_or(anyhow!("affine does not have value at index 0"))?,
            affine
                .get(1)
                .cloned()
                .ok_or(anyhow!("affine does not have value at index 1"))?,
            affine
                .get(3)
                .cloned()
                .ok_or(anyhow!("affine does not have value at index 3"))?,
            affine
                .get(4)
                .cloned()
                .ok_or(anyhow!("affine does not have value at index 4"))?,
            affine
                .get(6)
                .cloned()
                .ok_or(anyhow!("affine does not have value at index 6"))?,
            affine
                .get(7)
                .cloned()
                .ok_or(anyhow!("affine does not have value at index 7"))?,
        ],
    );

    Ok(())
}

View on GitHub (pinned to bbc5354502)