{"record":{"id":"b1caf47e06d0c480","repo":"pola-rs/polars","slug":"dtype-is-unknown-consider-supplying-data-types-fo","errorCode":null,"errorMessage":"dtype is unknown; consider supplying data-types for all operations","messagePattern":"dtype is unknown; consider supplying data-types for all operations","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-core/src/series/from.rs","lineNumber":163,"sourceCode":"                if let Some(arr) = chunks[0].as_any().downcast_ref::<FixedSizeBinaryArray>() {\n                    assert_eq!(chunks.len(), 1);\n                    // SAFETY:\n                    // this is highly unsafe. it will dereference a raw ptr on the heap\n                    // make sure the ptr is allocated and from this pid\n                    // (the pid is checked before dereference)\n                    {\n                        let pe = PolarsExtension::new(arr.clone());\n                        let s = pe.get_series(&name);\n                        pe.take_and_forget();\n                        s\n                    }\n                } else {\n                    unsafe { get_object_builder(name, 0).from_chunks(chunks) }\n                }\n            },\n            Null => new_null(name, &chunks),\n            Unknown(_) => {\n                panic!(\"dtype is unknown; consider supplying data-types for all operations\")\n            },\n            #[allow(unreachable_patterns)]\n            _ => unreachable!(),\n        }\n    }\n\n    /// # Safety\n    /// The caller must ensure that the given `dtype` matches all the `ArrayRef` dtypes.\n    pub unsafe fn _try_from_arrow_unchecked(\n        name: PlSmallStr,\n        chunks: Vec<ArrayRef>,\n        dtype: &ArrowDataType,\n    ) -> PolarsResult<Self> {\n        Self::_try_from_arrow_unchecked_with_md(name, chunks, dtype, None)\n    }\n\n    /// Create a new Series without checking if the inner dtype of the chunks is correct\n    ///","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/pola-rs/polars/blob/68506541d2de983056c9eb244e1ea05fab377dfc/crates/polars-core/src/series/from.rs#L145-L181","documentation":"When polars reconstructs a Series from raw Arrow chunks it matches on the DataType. DataType::Unknown means the type was never resolved (placeholder used before schema inference or when type information was dropped); it cannot back a Series, so the constructor panics with a hint to supply data-types for all operations.","triggerScenarios":"Series::from chunks whose schema carries unknown/placeholder types: lazy scans where the schema was not supplied (scan_csv/scan_ipc without schema or inference), custom FFI code passing Unknown dtypes, or plans executed before type resolution.","commonSituations":"scan_* with schema overrides that leave columns untyped; Arrow data crossing systems that discard type metadata; queries built dynamically where a projection references a column with no known dtype; bugs in code that constructs DataType::Unknown placeholders.","solutions":["Supply a full schema: pass schema= to scan_csv/scan_ipc or set infer_schema_length > 0","Cast/resolve the column to a concrete dtype before converting to Series or executing","Validate that no column in the plan has dtype Unknown before execution and fail with a descriptive error"],"exampleFix":"# before\nlf = pl.scan_csv(\"f.csv\", schema={\"a\": pl.Unknown, \"b\": pl.Int64})\nlf.collect()  # panics\n\n# after\nlf = pl.scan_csv(\"f.csv\", infer_schema_length=1000)\nlf.collect()","handlingStrategy":"validation","validationCode":"fn schema_fully_typed(schema: &Schema) -> bool {\n    schema.iter_values().all(|dt| !matches!(dt, DataType::Unknown(_)))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always supply a concrete schema (or enable inference) for scans and Series-from-Arrow paths","Fail fast with a clear error when any planned column dtype is Unknown","Avoid constructing DataType::Unknown placeholders in dynamic query builders"],"tags":["polars","dtype-unknown","schema","series-construction","panic"],"backgroundTag":"missing-type-information","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"}