pola-rs/polars · error
activate 'dtype-array'
Error message
activate 'dtype-array'
What it means
This panic is a deliberate guard: FixedSizeListArray::arr_from_iter_with_dtype still compiles when polars-arrow is built without the dtype-array feature, but the fixed-width machinery behind it is feature-gated, so the cfg(not(feature = "dtype-array")) body just panics with 'activate 'dtype-array''.
Source
Thrown at crates/polars-arrow/src/array/static_array_collect.rs:821
#[cfg(feature = "dtype-array")]
{
let ArrowDataType::FixedSizeList(_, width) = &dtype else {
panic!("FixedSizeListArray::arr_from_iter_with_dtype called with non-Array dtype");
};
let iter_values: Vec<_> = iter.into_iter().collect();
let mut builder = AnonymousFixedSizeListArrayBuilder::new(iter_values.len(), *width);
for arr in iter_values {
builder.push(arr.into_boxed_array());
}
let inner = dtype
.inner_dtype()
.expect("expected nested type in ListArray collect");
builder
.finish(Some(&inner.underlying_physical_type()))
.unwrap()
}
#[cfg(not(feature = "dtype-array"))]
panic!("activate 'dtype-array'")
}
fn try_arr_from_iter_with_dtype<E, I: IntoIterator<Item = Result<Box<dyn Array>, E>>>(
dtype: ArrowDataType,
iter: I,
) -> Result<Self, E> {
let iter_values = iter.into_iter().collect::<Result<Vec<_>, E>>()?;
Ok(Self::arr_from_iter_with_dtype(dtype, iter_values))
}
}
impl ArrayFromIterDtype<Option<Box<dyn Array>>> for FixedSizeListArray {
#[allow(unused_variables)]
fn arr_from_iter_with_dtype<I: IntoIterator<Item = Option<Box<dyn Array>>>>(
dtype: ArrowDataType,
iter: I,
) -> Self {
#[cfg(feature = "dtype-array")]View on GitHub (pinned to 9b5d73fd00)
Solutions
- Add features = ["dtype-array"] to the polars-arrow (or polars) dependency in Cargo.toml
- Make sure the crate that actually calls the collect API — not merely a transitive one — enables the feature
- Verify the resolved build with cargo tree -e features -i polars-arrow | grep dtype-array
Example fix
# before
polars-arrow = "0.5"
# after
polars-arrow = { version = "0.5", features = ["dtype-array"] } Defensive patterns
Strategy: validation
Validate before calling
# Cargo.toml — the crate calling the API must enable the feature:
[dependencies]
polars-arrow = { version = "0.5", features = ["dtype-array"] }
# verify the resolved build actually carries it:
# cargo tree -e features -i polars-arrow | grep dtype-array Prevention
- Enable dtype-array in every crate that calls fixed-size-list collect paths
- After dependency upgrades, re-check feature resolution with cargo tree -e features
- Add a smoke test that builds one FixedSizeListArray so a missing feature fails in CI, not production
When it happens
Trigger: Calling any collect-into-FixedSizeListArray path (arr_from_iter_with_dtype / try_arr_from_iter_with_dtype) in a build of polars-arrow whose resolved Cargo features do not include dtype-array — e.g. depending on polars-arrow with default-features = false.
Common situations: A new crate adds polars-arrow with default features only; Cargo feature unification resolves polars-arrow without dtype-array because another dependency requested a reduced build; a polars upgrade split the feature out and the pin no longer enables it.
Related errors
- The crate was compiled without IPC compression. Use `io_ipc_
- FixedSizeListArray::arr_from_iter_with_dtype called with non
- StructArray must be initialized with DataType::Struct
- Union struct must be created with the corresponding Union Da
- cannot set validity of a union array
AI-assisted analysis of pola-rs/polars@9b5d73fd00 (2026-08-19).
Data as JSON: /api/errors/a987d1c89280dfe2.
Report an issue: GitHub.