pola-rs/polars · error
failed to format duration
Error message
failed to format duration
What it means
Error "failed to format duration" thrown in pola-rs/polars.
Source
Thrown at crates/polars-core/src/chunked_array/temporal/duration.rs:88
match format {
"iso" | "iso:strict" => {
let out: StringChunked =
self.phys
.apply_nonnull_values_generic(DataType::String, |v: i64| {
s.clear();
iso_duration_string(&mut s, v, self.time_unit());
s.clone()
});
Ok(out)
},
"polars" => {
let out: StringChunked =
self.phys
.apply_nonnull_values_generic(DataType::String, |v: i64| {
s.clear();
fmt_duration_string(&mut s, v, self.time_unit())
.map_err(|e| polars_err!(ComputeError: "{:?}", e))
.expect("failed to format duration");
s.clone()
});
Ok(out)
},
_ => {
polars_bail!(
InvalidOperation: "format {:?} not supported for Duration type (expected one of 'iso' or 'polars')",
format
)
},
}
}
/// Construct a new [`DurationChunked`] from an iterator over [`ChronoDuration`].
pub fn from_duration<I: IntoIterator<Item = ChronoDuration>>(
name: PlSmallStr,
v: I,
tu: TimeUnit,View on GitHub (pinned to df599052da)
When it happens
Trigger: Thrown at crates/polars-core/src/chunked_array/temporal/duration.rs:88 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of pola-rs/polars@df599052da (2026-08-16).
Data as JSON: /api/errors/6b74b0ef843993b6.
Report an issue: GitHub.