pola-rs/polars · error
activate dtype-i128 feature
Error message
activate dtype-i128 feature
What it means
Panics in try_materialize_to_dtype when the dtype-i128 cargo feature is disabled but an integer literal exceeding i64 must be narrowed via try_into. The expect guards the feature configuration: building without dtype-i128 cannot represent the requested integer literal.
Solutions
- Enable the `dtype-i128` cargo feature to use 128-bit integer literals.
- Use Int64 or Decimal if i128 support cannot be enabled.
Defensive patterns
Strategy: fallback
When it happens
Trigger: This panic/expect fires when execution reaches an unguarded state described by: "activate dtype-i128 feature". 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 ("activate dtype-i128 feature"). 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/e199d1ab7e2924f1.
Report an issue: GitHub.
Appendix: source
Thrown at crates/polars-plan/src/plans/lit.rs:173
DataType::Array(_, size) => AnyValue::Array(s, *size),
_ => unreachable!(),
};
Ok(Scalar::new(dtype.clone(), value))
}
}
impl DynLiteralValue {
pub fn try_materialize_to_dtype(
self,
dtype: &DataType,
options: CastOptions,
) -> PolarsResult<Scalar> {
match self {
DynLiteralValue::Str(s) => Ok(Scalar::from(s).cast_with_options(dtype, options)?),
DynLiteralValue::Int(i) => {
#[cfg(not(feature = "dtype-i128"))]
let i: i64 = i.try_into().expect("activate dtype-i128 feature");
Ok(Scalar::from(i).cast_with_options(dtype, options)?)
},
DynLiteralValue::Float(f) => Ok(Scalar::from(f).cast_with_options(dtype, options)?),
DynLiteralValue::List(dyn_list_value) => {
dyn_list_value.try_materialize_to_dtype(dtype, options)
},
}
}
}
impl RangeLiteralValue {
pub fn try_materialize_to_series(self, dtype: &DataType) -> PolarsResult<Series> {
fn handle_range_oob(range: &RangeLiteralValue, to_dtype: &DataType) -> PolarsResult<()> {
polars_bail!(
InvalidOperation:
"conversion from `{}` to `{to_dtype}` failed for range({}, {})",
range.dtype, range.low, range.high,View on GitHub (pinned to 9b5d73fd00)