RyanCodrai/turbovec · error · io::Error
{} {detail}.
Error message
{} {detail}. What it means
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.
Source
Thrown at turbovec/src/io.rs:115
// from the source vectors is the only route.
let detail = match version {
Some(v @ 5..=6) => format!(
"is a version {v} turbovec index; this build reads only the v7 \
format. Convert it with turbovec::convert (or the `convert` \
example), which reads v5, v6 and v7 and writes any of them"
),
Some(v @ 1..=4) => format!(
"is a version {v} turbovec index, which predates the v5 rotation \
change and cannot be decoded by any current build; rebuild it \
from the source vectors"
),
Some(v) => format!(
"claims turbovec format version {v}, which this build does not \
recognise"
),
None => "is not a turbovec index".to_string(),
};
io::Error::new(
io::ErrorKind::InvalidData,
format!("{} {detail}.", path.display()),
)
}
View on GitHub (pinned to ccab9f325e)
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
Example fix
// before
let idx = Index::load("index.tv")?; // file written by turbovec 1.9
// after
// upgrade the crate first, or regenerate:
let idx = Index::build(vectors)?.save("index.tv")?;
let idx = Index::load("index.tv")?; Defensive patterns
Strategy: validation
Validate before calling
let meta = std::fs::metadata(path)?;
if meta.len() < 8 { return Err(anyhow!("not a turbovec index: too small")); }
// sniff the header version before loading
let hdr = std::fs::read(path)?;
let v = turbovec::io::peek_format_version(&hdr);
if !turbovec::io::supported_format_versions().contains(&v) {
return Err(anyhow!("format version {v:?} unsupported by this build"));
} Type guard
fn is_supported_index(path: &Path) -> bool {
std::fs::read(path).ok()
.and_then(|b| turbovec::io::peek_format_version(&b))
.map(|v| turbovec::io::supported_format_versions().contains(&v))
.unwrap_or(false)
} Try / catch
match Index::load(path) {
Err(e) if e.kind() == std::io::ErrorKind::InvalidData
&& e.to_string().contains("format version") => {
eprintln!("{path:?}: unsupported format; upgrade turbovec");
}
other => other?,
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- truncated file
- file too large for this platform
- {path} was written and committed, but syncing its parent dir
AI-assisted analysis of RyanCodrai/turbovec@ccab9f325e (2026-09-06).
Data as JSON: /api/errors/90e624133fbe18b5.
Report an issue: GitHub.