ajeetdsouza/zoxide · error · anyhow::Error
could not deserialize database: corrupted data
Error message
could not deserialize database: corrupted data
What it means
Error "could not deserialize database: corrupted data" thrown in ajeetdsouza/zoxide.
Source
Thrown at src/db/mod.rs:216
// Serialize sections into buffer.
bincode::serialize_into(&mut buffer, &Self::VERSION)?;
bincode::serialize_into(&mut buffer, &dirs)?;
Ok(buffer)
})()
.context("could not serialize database")
}
fn deserialize(bytes: &[u8]) -> Result<Vec<Dir<'_>>> {
// Assume a maximum size for the database. This prevents bincode from throwing
// strange errors when it encounters invalid data.
const MAX_SIZE: u64 = 32 << 20; // 32 MiB
let deserializer = &mut bincode::options().with_fixint_encoding().with_limit(MAX_SIZE);
// Split bytes into sections.
let version_size = deserializer.serialized_size(&Self::VERSION).unwrap() as _;
if bytes.len() < version_size {
bail!("could not deserialize database: corrupted data");
}
let (bytes_version, bytes_dirs) = bytes.split_at(version_size);
// Deserialize sections.
let version = deserializer.deserialize(bytes_version)?;
let dirs = match version {
Self::VERSION => {
deserializer.deserialize(bytes_dirs).context("could not deserialize database")?
}
version => {
bail!("unsupported version (got {version}, supports {})", Self::VERSION)
}
};
Ok(dirs)
}
}
View on GitHub (pinned to 8a3f76da90)
Solutions
- Restore the database from a backup if available
- Delete the corrupted database file and let zoxide recreate it (ranking history will be lost)
When it happens
Trigger: Thrown at src/db/mod.rs:216 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ajeetdsouza/zoxide@8a3f76da90 (2026-08-19).
Data as JSON: /api/errors/ac9538329309064a.
Report an issue: GitHub.