{"record":{"id":"61b16b8b55e344c9","repo":"pola-rs/polars","slug":"cannot-coerce-datatypes","errorCode":null,"errorMessage":"cannot coerce datatypes","messagePattern":"cannot coerce datatypes","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-core/src/series/arithmetic/borrowed.rs","lineNumber":272,"sourceCode":"\n            let ca: Float64Chunked =\n                arity::binary_elementwise(lhs, rhs, |opt_l, opt_r| match (opt_l, opt_r) {\n                    (Some(l), Some(r)) => {\n                        if r.is_zero() {\n                            None\n                        } else {\n                            Some(l / r)\n                        }\n                    },\n                    _ => None,\n                });\n            Ok(ca.into_series())\n        }\n    }\n\n    impl NumOpsDispatchChecked for Series {\n        fn checked_div(&self, rhs: &Series) -> PolarsResult<Series> {\n            let (lhs, rhs) = coerce_lhs_rhs(self, rhs).expect(\"cannot coerce datatypes\");\n            lhs.as_ref().as_ref().checked_div(rhs.as_ref())\n        }\n\n        fn checked_div_num<T: ToPrimitive>(&self, rhs: T) -> PolarsResult<Series> {\n            use DataType::*;\n            let s = self.to_physical_repr();\n\n            let out = match s.dtype() {\n                #[cfg(feature = \"dtype-u8\")]\n                UInt8 => s\n                    .u8()\n                    .unwrap()\n                    .apply(|opt_v| opt_v.and_then(|v| v.checked_div(rhs.to_u8().unwrap())))\n                    .into_series(),\n                #[cfg(feature = \"dtype-i8\")]\n                Int8 => s\n                    .i8()\n                    .unwrap()","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/crates/polars-core/src/series/arithmetic/borrowed.rs#L254-L290","documentation":"Error \"cannot coerce datatypes\" thrown in pola-rs/polars.","triggerScenarios":"Thrown at crates/polars-core/src/series/arithmetic/borrowed.rs:272 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"}