pola-rs/polars · error
FixedOffset::east out of bounds
Error message
FixedOffset::east out of bounds
What it means
expect in parse_timezone_offset: the computed offset in seconds (hours*3600 + minutes*60) exceeds chrono's FixedOffset bounds of ±24 hours (e.g. a parsed hours field larger than 24). The input offset string was syntactically OK but semantically out of range.
Solutions
- Keep the UTC offset within +/-24 hours (86,400 seconds); values beyond that are rejected by chrono::FixedOffset.
- Validate the offset parsed from the timezone string before constructing the FixedOffset.
Defensive patterns
Strategy: validation
When it happens
Trigger: This panic/expect fires when execution reaches an unguarded state described by: "FixedOffset::east out of bounds". Typical triggers: unsupported dtype or feature-gated code path reached at runtime, invalid user input or environment variable value, calling API methods in the wrong order or on mismatched types, or data (lengths, offsets, ranges) violating the function's preconditions.
Common situations: Encountered when input data or configuration does not meet the preconditions of the throwing code path ("FixedOffset::east out of bounds"). Common cases: missing Cargo feature flags, mismatched dtypes/lengths between arrays or series, out-of-range temporal values, malformed environment variables, or operations on unsupported/complex nested types.
AI-assisted analysis of pola-rs/polars@9b5d73fd00 (2026-08-19).
Data as JSON: /api/errors/655fd84955f11326.
Report an issue: GitHub.
Appendix: source
Thrown at crates/polars-arrow/src/temporal_conversions.rs:301
}
static ERR_MSG: &str = "timezone offset must be of the form [-]00:00";
let mut a = offset.split(':');
let first: &str = a
.next()
.ok_or_else(|| polars_err!(InvalidOperation: ERR_MSG))?;
let last = a
.next()
.ok_or_else(|| polars_err!(InvalidOperation: ERR_MSG))?;
let hours: i32 = first
.parse()
.map_err(|_| polars_err!(InvalidOperation: ERR_MSG))?;
let minutes: i32 = last
.parse()
.map_err(|_| polars_err!(InvalidOperation: ERR_MSG))?;
Ok(FixedOffset::east_opt(hours * 60 * 60 + minutes * 60)
.expect("FixedOffset::east out of bounds"))
}
/// Parses `value` to a [`chrono_tz::Tz`] with the Arrow's definition of timestamp with a timezone.
#[cfg(feature = "chrono-tz")]
#[cfg_attr(docsrs, doc(cfg(feature = "chrono-tz")))]
pub fn parse_offset_tz(timezone: &str) -> PolarsResult<chrono_tz::Tz> {
timezone
.parse::<chrono_tz::Tz>()
.map_err(|_| polars_err!(InvalidOperation: "timezone \"{timezone}\" cannot be parsed"))
}
View on GitHub (pinned to 9b5d73fd00)