pola-rs/polars · error · PolarsError::InvalidOperation

fill-null strategy {:?} is not supported

Error message

fill-null strategy {:?} is not supported

What it means

todo!/unreachable-style panic arm in the fill_null strategy dispatch for a dtype with no fill strategy implemented (the match fell through). The requested FillNullStrategy is unsupported for that column's type in this build; use a different strategy or fill via expression.

Source

Thrown at crates/polars-core/src/chunked_array/ops/fill_null.rs:403

        FillNullStrategy::One => ca.fill_null_with_values(true).map(|ca| ca.into_series()),
        FillNullStrategy::Zero => ca.fill_null_with_values(false).map(|ca| ca.into_series()),
        FillNullStrategy::Forward(_) => unreachable!(),
        FillNullStrategy::Backward(_) => unreachable!(),
    }
}

fn fill_null_binary(ca: &BinaryChunked, strategy: FillNullStrategy) -> PolarsResult<BinaryChunked> {
    match strategy {
        FillNullStrategy::Min => {
            ca.fill_null_with_values(ca.min_binary().ok_or_else(err_fill_null)?)
        },
        FillNullStrategy::Max => {
            ca.fill_null_with_values(ca.max_binary().ok_or_else(err_fill_null)?)
        },
        FillNullStrategy::Zero => ca.fill_null_with_values(&[]),
        FillNullStrategy::Forward(_) => unreachable!(),
        FillNullStrategy::Backward(_) => unreachable!(),
        strat => polars_bail!(InvalidOperation: "fill-null strategy {:?} is not supported", strat),
    }
}

impl<T> ChunkFillNullValue<T::Native> for ChunkedArray<T>
where
    T: PolarsNumericType,
{
    fn fill_null_with_values(&self, value: T::Native) -> PolarsResult<Self> {
        Ok(self.apply_kernel(&|arr| Box::new(set_at_nulls(arr, value))))
    }
}

impl ChunkFillNullValue<bool> for BooleanChunked {
    fn fill_null_with_values(&self, value: bool) -> PolarsResult<Self> {
        self.set(&self.is_null(), Some(value))
    }
}

View on GitHub (pinned to 9b5d73fd00)

Solutions

  1. Use a supported FillNullStrategy: Forward, Backward, Mean, Min, Max, Zero, One, or a literal value.
  2. For unsupported strategies on this dtype, cast the column first or implement the fill manually.
Defensive patterns

Strategy: fallback

When it happens

Trigger: This panic/expect fires when execution reaches an unguarded state described by: "fill-null strategy {:?} is not supported". 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 ("fill-null strategy {:?} is not supported"). 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@9b5d73fd00 (2026-08-19). Data as JSON: /api/errors/4244e452f1928b3e. Report an issue: GitHub.