pola-rs/polars · error

nested lists

Error message

nested lists

What it means

Feature-configuration expect in the integer-list literal path: with dtype-i128 disabled, each Int128 literal is cast to i64, and this expect fires when a value does not fit in i64. The string 'nested lists' labels the surrounding literal-materialization context; the actual fault is an out-of-range integer under the disabled feature.

Source

Thrown at crates/polars-plan/src/plans/lit.rs:148

                #[cfg(feature = "dtype-i128")]
                {
                    Int128Chunked::from_iter_options(get_literal_name(), vs.into_iter())
                        .into_series()
                }

                #[cfg(not(feature = "dtype-i128"))]
                {
                    Int64Chunked::from_iter_options(
                        get_literal_name(),
                        vs.into_iter().map(|v| v.map(|v| v as i64)),
                    )
                    .into_series()
                }
            },
            DynListLiteralValue::Float(vs) => {
                Float64Chunked::from_iter_options(get_literal_name(), vs.into_iter()).into_series()
            },
            DynListLiteralValue::List(_) => todo!("nested lists"),
        };

        let s = s.cast_with_options(inner_dtype, options)?;
        let value = match dtype {
            DataType::List(_) => AnyValue::List(s),
            #[cfg(feature = "dtype-array")]
            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,

View on GitHub (pinned to 9b5d73fd00)

Solutions

  1. Nested list literals are not supported here; construct nested lists via Series builders instead.
  2. Build the nested list column from typed chunks rather than a literal.
Defensive patterns

Strategy: fallback

When it happens

Trigger: This panic/expect fires when execution reaches an unguarded state described by: "nested lists". 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 ("nested lists"). 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/1799b822d7cb1aa9. Report an issue: GitHub.