{"record":{"id":"90e624133fbe18b5","repo":"RyanCodrai/turbovec","slug":"detail","errorCode":null,"errorMessage":"{} {detail}.","messagePattern":"\\{\\} \\{detail\\}\\.","errorType":"validation","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"turbovec/src/io.rs","lineNumber":115,"sourceCode":"    // from the source vectors is the only route.\n    let detail = match version {\n        Some(v @ 5..=6) => format!(\n            \"is a version {v} turbovec index; this build reads only the v7 \\\n             format. Convert it with turbovec::convert (or the `convert` \\\n             example), which reads v5, v6 and v7 and writes any of them\"\n        ),\n        Some(v @ 1..=4) => format!(\n            \"is a version {v} turbovec index, which predates the v5 rotation \\\n             change and cannot be decoded by any current build; rebuild it \\\n             from the source vectors\"\n        ),\n        Some(v) => format!(\n            \"claims turbovec format version {v}, which this build does not \\\n             recognise\"\n        ),\n        None => \"is not a turbovec index\".to_string(),\n    };\n    io::Error::new(\n        io::ErrorKind::InvalidData,\n        format!(\"{} {detail}.\", path.display()),\n    )\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/RyanCodrai/turbovec/blob/ccab9f325e6ce2a270a87daf01ae4e443bcf2d49/turbovec/src/io.rs#L97-L133","documentation":"This io::Error of kind InvalidData is raised by legacy_format_error when a turbovec index file's magic header declares a format version this build does not recognise, or the file carries no version marker at all (so it is not a turbovec index). The path is prefixed to the message so you know which file failed. It guards the loader against forward-incompatible or non-turbovec files.","triggerScenarios":"Calling load/open on a file whose header version field is greater than the max version supported by this build, or whose header lacks the version field entirely (corrupt or foreign file passed as an index path).","commonSituations":"Opening an index written by a newer turbovec release with an older binary; pointing the loader at an unrelated file that happens to sit at the index path; partial/failed writes from another tool.","solutions":["Upgrade turbovec to a version that recognises the file's format version","Verify the path points to a genuine turbovec index file, not another artifact","Rebuild/re-export the index with the current library version","Check for truncated or corrupted files and regenerate them from source vectors"],"exampleFix":"// before\nlet idx = Index::load(\"index.tv\")?; // file written by turbovec 1.9\n// after\n// upgrade the crate first, or regenerate:\nlet idx = Index::build(vectors)?.save(\"index.tv\")?;\nlet idx = Index::load(\"index.tv\")?;","handlingStrategy":"validation","validationCode":"let meta = std::fs::metadata(path)?;\nif meta.len() < 8 { return Err(anyhow!(\"not a turbovec index: too small\")); }\n// sniff the header version before loading\nlet hdr = std::fs::read(path)?;\nlet v = turbovec::io::peek_format_version(&hdr);\nif !turbovec::io::supported_format_versions().contains(&v) {\n    return Err(anyhow!(\"format version {v:?} unsupported by this build\"));\n}","typeGuard":"fn is_supported_index(path: &Path) -> bool {\n    std::fs::read(path).ok()\n        .and_then(|b| turbovec::io::peek_format_version(&b))\n        .map(|v| turbovec::io::supported_format_versions().contains(&v))\n        .unwrap_or(false)\n}","tryCatchPattern":"match Index::load(path) {\n    Err(e) if e.kind() == std::io::ErrorKind::InvalidData\n        && e.to_string().contains(\"format version\") => {\n        eprintln!(\"{path:?}: unsupported format; upgrade turbovec\");\n    }\n    other => other?,\n}","preventionTips":["Pin and upgrade turbovec consistently across services writing and reading indexes","Never hand the loader arbitrary files; keep index paths namespaced","Validate header magic/version before load in deployment scripts"],"tags":["io","file-format","version-mismatch"],"backgroundTag":"incompatible-source-type","analyzedSha":"ccab9f325e6ce2a270a87daf01ae4e443bcf2d49","analyzedAt":"2026-09-06T08:39:18.516Z","contentChangedAt":"2026-09-06T08:39:18.516Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}