{"record":{"id":"cb61066a40b480be","repo":"pola-rs/polars","slug":"to-list-not-implemented-for-unknown","errorCode":null,"errorMessage":"to_list not implemented for unknown","messagePattern":"to_list not implemented for unknown","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-python/src/series/export.rs","lineNumber":161,"sourceCode":"                        iter: RepeatN<Option<u8>>,\n                        n: usize,\n                    }\n                    impl Iterator for NullIter {\n                        type Item = Option<u8>;\n\n                        fn next(&mut self) -> Option<Self::Item> {\n                            self.iter.next()\n                        }\n                        fn size_hint(&self) -> (usize, Option<usize>) {\n                            (self.n, Some(self.n))\n                        }\n                    }\n                    impl ExactSizeIterator for NullIter {}\n\n                    PyList::new(py, NullIter { iter, n })?\n                },\n                DataType::Unknown(_) => {\n                    panic!(\"to_list not implemented for unknown\")\n                },\n                DataType::BinaryOffset => {\n                    unreachable!()\n                },\n                DataType::Map(_, _) => {\n                    let ca = series.map().map_err(PyPolarsErr::from)?;\n                    PyList::new(py, ca.any_value_iter().map(Wrap))?\n                },\n                DataType::Extension(_, _) => {\n                    return to_list_recursive(py, series.ext().unwrap().storage());\n                },\n            };\n            Ok(pylist.into_any())\n        }\n\n        to_list_recursive(py, series)\n    }\n","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/pola-rs/polars/blob/68506541d2de983056c9eb244e1ea05fab377dfc/crates/polars-python/src/series/export.rs#L143-L179","documentation":"Guard in Series.to_list (python export): the series dtype is Unknown (e.g. from an unresolved lazy schema or dsl scan), for which no Python list conversion exists. Resolve the schema (collect with known dtypes) before exporting.","triggerScenarios":"Calling Series.to_list() on a Series of dtype Unknown.","commonSituations":"See trigger scenarios.","solutions":["Cast the Series to a concrete dtype before calling to_list(); 'unknown' columns come from empty/all-null data — give them a dtype via cast or schema."],"exampleFix":"s = pl.Series('a', [], dtype=pl.Int64)\ns.to_list()","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"68506541d2de983056c9eb244e1ea05fab377dfc","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}