{"record":{"id":"20b1c01c6b3dd1cd","repo":"pola-rs/polars","slug":"dtype-not-supported","errorCode":null,"errorMessage":"dtype {:?} not supported","messagePattern":"dtype (.+?) not supported","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-python/src/utils.rs","lineNumber":68,"sourceCode":"                CategoricalPhysical::U8 => $self.cat8().unwrap().$method($($args),*),\n                CategoricalPhysical::U16 => $self.cat16().unwrap().$method($($args),*),\n                CategoricalPhysical::U32 => $self.cat32().unwrap().$method($($args),*),\n            },\n\n            #[cfg(feature = \"object\")]\n            DataType::Object(_) => {\n                $self\n                .as_any()\n                .downcast_ref::<ObjectChunked<ObjectValue>>()\n                .unwrap()\n                .$method($($args),*)\n            },\n            DataType::Map(_, _) => $self.map().unwrap().$method($($args),*),\n            DataType::Extension(_, _) => $self.ext().unwrap().$method($($args),*),\n\n            DataType::Null => $self.null().unwrap().$method($($args),*),\n\n            dt @ (DataType::BinaryOffset | DataType::Unknown(_)) => panic!(\"dtype {:?} not supported\", dt)\n        }\n    }\n}\n\n/// Boilerplate for `|e| PyPolarsErr::from(e).into()`\n#[allow(unused)]\npub(crate) fn to_py_err<E: Into<PyPolarsErr>>(e: E) -> PyErr {\n    e.into().into()\n}\n\npub trait EnterPolarsExt {\n    /// Whenever you have a block of code in the public Python API that\n    /// (potentially) takes a long time, wrap it in enter_polars. This will\n    /// ensure we release the GIL and catch KeyboardInterrupts.\n    ///\n    /// This not only can increase performance and usability, it can avoid\n    /// deadlocks on the GIL for Python UDFs.\n    fn enter_polars<T, E, F>(self, f: F) -> PyResult<T>","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-python/src/utils.rs#L50-L86","documentation":"This panic comes from a Polars internal match macro that dispatches operations per DataType. It fires when the operation is invoked on a dtype that has no mapping in the macro arms — specifically BinaryOffset or Unknown. It means the engine reached a code path with a dtype representation it cannot handle for this operation.","triggerScenarios":"Calling any expression/dtype-dispatched operation (via the match_dtype_to_physical/macro machinery in crates/polars-python/src/utils.rs) on a Series or expression whose DataType is DataType::BinaryOffset or DataType::Unknown(_).","commonSituations":"Working with large Binary/BinaryOffset columns produced internally by Polars (e.g. from certain IO or string caches), or handling a dtype that failed to resolve (Unknown) after deserialization of a lazy plan across version mismatch, then applying a per-dtype dispatched operation.","solutions":["Cast the column to a supported dtype first, e.g. df.with_columns(pl.col('c').cast(pl.Binary)) — BinaryOffset maps to plain Binary at the Python surface.","Check polars version alignment: ensure the same polars version produced and consumes any serialized plans/IPC data so Unknown dtypes don't appear.","If BinaryOffset is surfaced unexpectedly, upgrade polars; internal offset variants are usually transient representations.","Report the specific operation + dtype to the Polars maintainers if you hit it with a normal Binary column — it indicates a missed dispatch arm."],"exampleFix":"// before\ndf.select(pl.col(\"payload\").str.len_bytes())\n// after\ndf.select(pl.col(\"payload\").cast(pl.Binary).str.len_bytes())","handlingStrategy":"validation","validationCode":"import polars as pl\nassert df.schema[\"payload\"] != pl.Unknown, \"dtype unresolved; cannot dispatch\"\nassert df.schema[\"payload\"].is_not_unknown()","typeGuard":"def has_supported_dtype(col: pl.Expr, df: pl.DataFrame) -> bool:\n    return not isinstance(df.schema.get(col.meta.output_name()), (pl.Unknown,))","tryCatchPattern":"try:\n    out = df.select(pl.col(\"payload\").str.len_bytes())\nexcept pl.exceptions.PolarsPanicError as e:\n    out = df.with_columns(pl.col(\"payload\").cast(pl.Binary)).select(pl.col(\"payload\").str.len_bytes())","preventionTips":["Cast Binary-ish columns to pl.Binary before dtype-dispatched operations","Keep producer and consumer polars versions aligned for serialized plans/IPC","Treat pl.Unknown schemas as a signal to re-resolve before computing","Pin polars versions in lockstep across services"],"tags":["rust","panic","dtype","unsupported-dtype"],"backgroundTag":"unsupported-dtype","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}