rustfs/rustfs · error · std::io::Error
UnexpectedEof
UnexpectedEof
Error message
Unexpected EOF
What it means
Conversion pair in rustfs-filemeta's Error type: any std::io::Error of kind UnexpectedEof maps to Error::Unexpected (and back to io UnexpectedEof with message 'Unexpected EOF'). It surfaces whenever a metadata (xl.meta) read ends before the expected number of bytes — the file/stream is shorter than the header or stat size claims.
Source
Thrown at crates/filemeta/src/error.rs:142
Error::UuidParse(s) => Error::UuidParse(s.clone()),
Error::Unexpected => Error::Unexpected,
}
}
}
impl From<std::io::Error> for Error {
fn from(e: std::io::Error) -> Self {
match e.kind() {
std::io::ErrorKind::UnexpectedEof => Error::Unexpected,
_ => Error::Io(e),
}
}
}
impl From<Error> for std::io::Error {
fn from(e: Error) -> Self {
match e {
Error::Unexpected => std::io::Error::new(std::io::ErrorKind::UnexpectedEof, "Unexpected EOF"),
Error::Io(e) => e,
_ => std::io::Error::other(e.to_string()),
}
}
}
impl From<rmp_serde::decode::Error> for Error {
fn from(e: rmp_serde::decode::Error) -> Self {
Error::RmpSerdeDecode(e.to_string())
}
}
impl From<rmp_serde::encode::Error> for Error {
fn from(e: rmp_serde::encode::Error) -> Self {
Error::RmpSerdeEncode(e.to_string())
}
}
View on GitHub (pinned to 9e6e02ea09)
Solutions
- Run a heal on the bucket/object so erasure coding rebuilds the truncated xl.meta from other shards
- If all shards are truncated, restore the object from backup or re-upload it
- Check disk health (SMART) on the node reporting the EOF — repeated UnexpectedEof on one drive indicates failing hardware
- Avoid file-level copies of a live pool; snapshot or quiesce before copying
Defensive patterns
Strategy: try-catch
Try / catch
use rustfs_filemeta::error::Error;
match FileMeta::load(&buf) {
Err(Error::Unexpected) => {
// xl.meta shorter than expected: heal the object or restore from replicas;
// do not retry the same read — the file on disk is truncated
}
other => other?,
} Prevention
- Run periodic heal scans so truncated metadata is rebuilt before reads hit it
- Monitor SMART/disk errors on nodes that repeatedly produce UnexpectedEof
- Never file-copy a live pool; quiesce or snapshot first
When it happens
Trigger: read_xl_meta* / FileMeta::load paths read an xl.meta file whose stat size says N bytes but the read returns EOF earlier (truncated file, concurrent writer, disk fault); the io error propagates through From<io::Error> and collapses into Error::Unexpected.
Common situations: Power loss mid-write leaving a truncated xl.meta; disk sectors going bad; copying a pool with rsync while it is being written; inspecting an xl.meta partially downloaded; heal reading a damaged shard.
Related errors
- Unexpected EOF
- truncated msgpack value
- Unknown minor metadata version
- Unknown major metadata version
- {}: invalid UTF-8 header value for `{}` [rustfs_signer_heade
AI-assisted analysis of rustfs/rustfs@9e6e02ea09 (2026-08-16).
Data as JSON: /api/errors/6399f313db5ba915.
Report an issue: GitHub.