{"record":{"id":"0becb1e9a4254398","repo":"pola-rs/polars","slug":"invalidinput","errorCode":"InvalidInput","errorMessage":"invalid seek to a negative or overflowing position","messagePattern":"invalid seek to a negative or overflowing position","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"crates/polars-utils/src/chunked_bytes_cursor.rs","lineNumber":129,"sourceCode":"impl<'a, T> std::io::Seek for FixedSizeChunkedBytesCursor<'a, T> {\n    fn seek(&mut self, pos: std::io::SeekFrom) -> std::io::Result<u64> {\n        // Mostly copied from io::Cursor::seek().\n        use std::io::SeekFrom;\n\n        let (base_pos, offset) = match pos {\n            SeekFrom::Start(n) => {\n                self.position = usize::try_from(n).unwrap().min(self.total_size);\n                return Ok(self.position as u64);\n            },\n            SeekFrom::End(n) => (self.total_size as u64, n),\n            SeekFrom::Current(n) => (self.position as u64, n),\n        };\n        match base_pos.checked_add_signed(offset) {\n            Some(n) => {\n                self.position = usize::try_from(n).unwrap();\n                Ok(self.position as u64)\n            },\n            None => Err(std::io::Error::new(\n                std::io::ErrorKind::InvalidInput,\n                \"invalid seek to a negative or overflowing position\",\n            )),\n        }\n    }\n}\n","sourceCodeStart":111,"sourceCodeEnd":136,"githubUrl":"https://github.com/pola-rs/polars/blob/fc24390824009e8fc5b7870e256273c1b140a019/crates/polars-utils/src/chunked_bytes_cursor.rs#L111-L136","documentation":"FixedSizeChunkedBytesCursor's std::io::Seek impl computes the new absolute position for SeekFrom::End/Current; if base_pos + offset is negative or exceeds u64 the arithmetic conversion fails and it returns this io::Error, mirroring std's Cursor behavior. Guarded by returning an error rather than panicking.","triggerScenarios":"Seeking a ChunkedBytesCursor to a negative or overflowing position.","commonSituations":"See trigger scenarios.","solutions":["Seek to a position within [0, len]; clamp negative or overflowing offsets before seeking."],"exampleFix":"pos = max(0, min(pos, len(buf)))\ncursor.seek(pos)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fc24390824009e8fc5b7870e256273c1b140a019","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}