{"record":{"id":"6b74b0ef843993b6","repo":"pola-rs/polars","slug":"failed-to-format-duration","errorCode":null,"errorMessage":"failed to format duration","messagePattern":"failed to format duration","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-core/src/chunked_array/temporal/duration.rs","lineNumber":88,"sourceCode":"        match format {\n            \"iso\" | \"iso:strict\" => {\n                let out: StringChunked =\n                    self.phys\n                        .apply_nonnull_values_generic(DataType::String, |v: i64| {\n                            s.clear();\n                            iso_duration_string(&mut s, v, self.time_unit());\n                            s.clone()\n                        });\n                Ok(out)\n            },\n            \"polars\" => {\n                let out: StringChunked =\n                    self.phys\n                        .apply_nonnull_values_generic(DataType::String, |v: i64| {\n                            s.clear();\n                            fmt_duration_string(&mut s, v, self.time_unit())\n                                .map_err(|e| polars_err!(ComputeError: \"{:?}\", e))\n                                .expect(\"failed to format duration\");\n                            s.clone()\n                        });\n                Ok(out)\n            },\n            _ => {\n                polars_bail!(\n                    InvalidOperation: \"format {:?} not supported for Duration type (expected one of 'iso' or 'polars')\",\n                    format\n                )\n            },\n        }\n    }\n\n    /// Construct a new [`DurationChunked`] from an iterator over [`ChronoDuration`].\n    pub fn from_duration<I: IntoIterator<Item = ChronoDuration>>(\n        name: PlSmallStr,\n        v: I,\n        tu: TimeUnit,","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/crates/polars-core/src/chunked_array/temporal/duration.rs#L70-L106","documentation":"Error \"failed to format duration\" thrown in pola-rs/polars.","triggerScenarios":"Thrown at crates/polars-core/src/chunked_array/temporal/duration.rs:88 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}