{"record":{"id":"c8ec7276ca592ca2","repo":"rustfs/rustfs","slug":"unexpected-eof-while-reading-s2-chunk-header","errorCode":null,"errorMessage":"unexpected EOF while reading S2 chunk header","messagePattern":"unexpected EOF while reading S2 chunk header","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/rio-v2/src/compress_reader.rs","lineNumber":318,"sourceCode":"\n        loop {\n            if *this.finished {\n                return Poll::Ready(Ok(()));\n            }\n\n            if !*this.reading_chunk {\n                while *this.header_read < CHUNK_HEADER_LEN {\n                    let mut read_buf = ReadBuf::new(&mut this.header_buf[*this.header_read..]);\n                    match this.inner.as_mut().poll_read(cx, &mut read_buf) {\n                        Poll::Pending => return Poll::Pending,\n                        Poll::Ready(Ok(())) => {\n                            let n = read_buf.filled().len();\n                            if n == 0 {\n                                if *this.header_read == 0 {\n                                    *this.finished = true;\n                                    return Poll::Ready(Ok(()));\n                                }\n                                return Poll::Ready(Err(io::Error::new(\n                                    io::ErrorKind::UnexpectedEof,\n                                    \"unexpected EOF while reading S2 chunk header\",\n                                )));\n                            }\n                            *this.header_read += n;\n                        }\n                        Poll::Ready(Err(err)) => return Poll::Ready(Err(err)),\n                    }\n                }\n\n                *this.chunk_type = this.header_buf[0];\n                *this.chunk_len =\n                    (this.header_buf[1] as usize) | ((this.header_buf[2] as usize) << 8) | ((this.header_buf[3] as usize) << 16);\n                *this.header_read = 0;\n\n                if this.chunk_buf.len() < *this.chunk_len {\n                    this.chunk_buf.resize(*this.chunk_len, 0);\n                }","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/rustfs/rustfs/blob/35af688cd9d41b4346fbe27dcf7250ba72046c1f/crates/rio-v2/src/compress_reader.rs#L300-L336","documentation":"S2 decompression stream ended before the fixed-length chunk header (type + 24-bit length + CRC) was fully read. Fires in rio-v2's async poll loop when the compressed input is truncated at a chunk boundary.","triggerScenarios":"Thrown at crates/rio-v2/src/compress_reader.rs:318 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fail with UnexpectedEof and heal the object","Verify complete chunk writes were committed","Retry the read from a healthy replica"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35af688cd9d41b4346fbe27dcf7250ba72046c1f","analyzedAt":"2026-08-20T21:57:04.799Z","contentChangedAt":"2026-08-20T21:57:04.799Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}