{"record":{"id":"1db7de2190f910e1","repo":"rustfs/rustfs","slug":"chunk-read-limit-must-be-non-zero","errorCode":null,"errorMessage":"chunk read limit must be non-zero","messagePattern":"chunk read limit must be non-zero","errorType":"validation","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/rio/src/http_reader.rs","lineNumber":1219,"sourceCode":"        if buf.remaining() == 0 {\n            return Poll::Ready(Ok(()));\n        }\n        match ChunkReader::poll_read_chunk(self.as_mut(), cx, buf.remaining()) {\n            Poll::Ready(Ok(Some(chunk))) => {\n                buf.put_slice(&chunk);\n                Poll::Ready(Ok(()))\n            }\n            Poll::Ready(Ok(None)) => Poll::Ready(Ok(())),\n            Poll::Ready(Err(err)) => Poll::Ready(Err(err)),\n            Poll::Pending => Poll::Pending,\n        }\n    }\n}\n\nimpl ChunkReader for HttpChunkReader {\n    fn poll_read_chunk(self: Pin<&mut Self>, cx: &mut Context<'_>, max: usize) -> Poll<io::Result<Option<Bytes>>> {\n        if max == 0 {\n            return Poll::Ready(Err(Error::new(io::ErrorKind::InvalidInput, \"chunk read limit must be non-zero\")));\n        }\n\n        let mut this = self.project();\n        if *this.consecutive_empty_chunks >= MAX_CONSECUTIVE_EMPTY_CHUNKS {\n            return Poll::Ready(Err(excessive_empty_chunks_error()));\n        }\n        loop {\n            if let Some(mut current) = this.current.take() {\n                let take = current.len().min(max);\n                let chunk = current.split_to(take);\n                if !current.is_empty() {\n                    *this.current = Some(current);\n                }\n                record_internode_recv_bytes(*this.track_internode_metrics, *this.internode_operation, take);\n                *this.stall_timer = None;\n                return Poll::Ready(Ok(Some(chunk)));\n            }\n","sourceCodeStart":1201,"sourceCodeEnd":1237,"githubUrl":"https://github.com/rustfs/rustfs/blob/35af688cd9d41b4346fbe27dcf7250ba72046c1f/crates/rio/src/http_reader.rs#L1201-L1237","documentation":"Programming-guard error: poll_read_chunk was invoked with a max chunk size of zero, which is not a meaningful read request. Indicates a caller bug in the chunked HTTP reader, not a data or network problem.","triggerScenarios":"Thrown at crates/rio/src/http_reader.rs:1219 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a non-zero max when polling for chunks","Guard call sites that compute max from possibly-zero sizes"],"exampleFix":null,"handlingStrategy":"validation","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"}