pola-rs/polars · error · std::io::Error
InvalidInput
InvalidInput
Error message
invalid seek to a negative or overflowing position
What it means
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.
Solutions
- Seek to a position within [0, len]; clamp negative or overflowing offsets before seeking.
Example fix
pos = max(0, min(pos, len(buf))) cursor.seek(pos)
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Seeking a ChunkedBytesCursor to a negative or overflowing position.
Common situations: See trigger scenarios.
AI-assisted analysis of pola-rs/polars@fc24390824 (2026-08-19).
Data as JSON: /api/errors/0becb1e9a4254398.
Report an issue: GitHub.
Appendix: source
Thrown at crates/polars-utils/src/chunked_bytes_cursor.rs:129
impl<'a, T> std::io::Seek for FixedSizeChunkedBytesCursor<'a, T> {
fn seek(&mut self, pos: std::io::SeekFrom) -> std::io::Result<u64> {
// Mostly copied from io::Cursor::seek().
use std::io::SeekFrom;
let (base_pos, offset) = match pos {
SeekFrom::Start(n) => {
self.position = usize::try_from(n).unwrap().min(self.total_size);
return Ok(self.position as u64);
},
SeekFrom::End(n) => (self.total_size as u64, n),
SeekFrom::Current(n) => (self.position as u64, n),
};
match base_pos.checked_add_signed(offset) {
Some(n) => {
self.position = usize::try_from(n).unwrap();
Ok(self.position as u64)
},
None => Err(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
"invalid seek to a negative or overflowing position",
)),
}
}
}
View on GitHub (pinned to fc24390824)