pola-rs/polars · error

not implemented for dtype {:?}

Error message

not implemented for dtype {:?}

What it means

The no_matching_dtype macro in polars-core utils dispatches on DataType to per-type code with feature-gated arms; when a dtype has no matching arm (unsupported or feature-disabled) it panics with 'not implemented for dtype {:?}' naming the dtype. Generic sentinel for unimplemented dtype-specific operations.

Source

Thrown at crates/polars-core/src/utils/mod.rs:396

            #[cfg(feature = "dtype-u8")]
            DataType::UInt8 => $macro!(u8 $(, $opt_args)*),
            #[cfg(feature = "dtype-u16")]
            DataType::UInt16 => $macro!(u16 $(, $opt_args)*),
            DataType::UInt32 => $macro!(u32 $(, $opt_args)*),
            DataType::UInt64 => $macro!(u64 $(, $opt_args)*),
            #[cfg(feature = "dtype-i8")]
            DataType::Int8 => $macro!(i8 $(, $opt_args)*),
            #[cfg(feature = "dtype-i16")]
            DataType::Int16 => $macro!(i16 $(, $opt_args)*),
            DataType::Int32 => $macro!(i32 $(, $opt_args)*),
            DataType::Int64 => $macro!(i64 $(, $opt_args)*),
            #[cfg(feature = "dtype-i128")]
            DataType::Int128 => $macro!(i128 $(, $opt_args)*),
            #[cfg(feature = "dtype-f16")]
            DataType::Float16 => $macro!(pf16 $(, $opt_args)*),
            DataType::Float32 => $macro!(f32 $(, $opt_args)*),
            DataType::Float64 => $macro!(f64 $(, $opt_args)*),
            dt => panic!("not implemented for dtype {:?}", dt),
        }
    }};
}

/// Apply a macro on the Series
#[macro_export]
macro_rules! match_dtype_to_logical_apply_macro {
    ($obj:expr, $macro:ident, $macro_string:ident, $macro_binary:ident, $macro_bool:ident $(, $opt_args:expr)*) => {{
        match $obj {
            DataType::String => $macro_string!($($opt_args)*),
            DataType::Binary => $macro_binary!($($opt_args)*),
            DataType::Boolean => $macro_bool!($($opt_args)*),
            #[cfg(feature = "dtype-u8")]
            DataType::UInt8 => $macro!(UInt8Type $(, $opt_args)*),
            #[cfg(feature = "dtype-u16")]
            DataType::UInt16 => $macro!(UInt16Type $(, $opt_args)*),
            DataType::UInt32 => $macro!(UInt32Type $(, $opt_args)*),
            DataType::UInt64 => $macro!(UInt64Type $(, $opt_args)*),

View on GitHub (pinned to 68506541d2)

Solutions

  1. This utility is not implemented for the dtype; cast to a supported dtype before calling.
  2. Check whether a `dtype-*` cargo feature adds support for this type.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: This panic/expect fires when execution reaches an unguarded state described by: "not implemented for dtype {:?}". 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 ("not implemented for dtype {:?}"). 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@68506541d2 (2026-08-19). Data as JSON: /api/errors/fdda7ea88a02886e. Report an issue: GitHub.