{"record":{"id":"a85399de8851029f","repo":"pola-rs/polars","slug":"expected-list-dtype","errorCode":null,"errorMessage":"expected list dtype","messagePattern":"expected list dtype","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-core/src/chunked_array/from_iterator_par.rs","lineNumber":277,"sourceCode":"        Some(error) => Err(error),\n        None => Ok(collection),\n    }\n}\n\nimpl FromParIterWithDtype<Option<Series>> for ListChunked {\n    fn from_par_iter_with_dtype<I>(iter: I, name: PlSmallStr, dtype: DataType) -> Self\n    where\n        I: IntoParallelIterator<Item = Option<Series>>,\n        Self: Sized,\n    {\n        let vectors = collect_into_linked_list_vec(iter);\n\n        let list_capacity: usize = get_capacity_from_par_results(&vectors);\n        let value_capacity = get_value_cap(&vectors);\n        if let DataType::List(dtype) = dtype {\n            materialize_list(name, &vectors, *dtype, value_capacity, list_capacity).unwrap()\n        } else {\n            panic!(\"expected list dtype\")\n        }\n    }\n}\n\npub trait ChunkedCollectParIterExt: ParallelIterator {\n    fn collect_ca_with_dtype<B: FromParIterWithDtype<Self::Item>>(\n        self,\n        name: PlSmallStr,\n        dtype: DataType,\n    ) -> B\n    where\n        Self: Sized,\n    {\n        B::from_par_iter_with_dtype(self, name, dtype)\n    }\n}\n\nimpl<I: ParallelIterator> ChunkedCollectParIterExt for I {}","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/pola-rs/polars/blob/fc24390824009e8fc5b7870e256273c1b140a019/crates/polars-core/src/chunked_array/from_iterator_par.rs#L259-L295","documentation":"ListChunked::from_par_iter_with_dtype expects the supplied dtype to be DataType::List(_); passing any other dtype (scalar, struct, etc.) while building a list series from parallel iteration falls through to this panic. Pass a List dtype (e.g. DataType::List(Box::new(inner))) to the builder.","triggerScenarios":"This panic/expect fires when execution reaches an unguarded state described by: \"expected list 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.","commonSituations":"Encountered when input data or configuration does not meet the preconditions of the throwing code path (\"expected list 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.","solutions":["Ensure the series/chunk being collected has a List dtype; cast or rebuild it as a list before the parallel collect.","Check that the iterator yields list-typed values matching the expected dtype."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fc24390824009e8fc5b7870e256273c1b140a019","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}