{"record":{"id":"c91be92cbc0044b9","repo":"pola-rs/polars","slug":"activate-the-dtype-struct-feature-to-handle-stru","errorCode":null,"errorMessage":"activate the 'dtype-struct' feature to handle struct data types","messagePattern":"activate the 'dtype-struct' feature to handle struct data types","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-core/src/datatypes/field.rs","lineNumber":277,"sourceCode":"                    );\n                    DataType::from_categories(cats)\n                } else if matches!(\n                    value_type.as_ref(),\n                    ArrowDataType::Utf8 | ArrowDataType::LargeUtf8 | ArrowDataType::Utf8View\n                ) {\n                    DataType::from_categories(Categories::global())\n                } else {\n                    Self::from_arrow(value_type, None)\n                }\n            },\n\n            #[cfg(feature = \"dtype-struct\")]\n            ArrowDataType::Struct(fields) => {\n                DataType::Struct(fields.iter().map(|fld| fld.into()).collect())\n            },\n            #[cfg(not(feature = \"dtype-struct\"))]\n            ArrowDataType::Struct(_) => {\n                panic!(\"activate the 'dtype-struct' feature to handle struct data types\")\n            },\n            ArrowDataType::Extension(ext) if ext.name.as_str() == POLARS_OBJECT_EXTENSION_NAME => {\n                #[cfg(feature = \"object\")]\n                {\n                    DataType::Object(\"object\")\n                }\n                #[cfg(not(feature = \"object\"))]\n                {\n                    panic!(\"activate the 'object' feature to be able to load POLARS_EXTENSION_TYPE\")\n                }\n            },\n            #[cfg(feature = \"dtype-extension\")]\n            ArrowDataType::Extension(ext) => {\n                use crate::prelude::extension::get_extension_type_or_storage;\n                let storage = DataType::from_arrow(&ext.inner, md);\n                match get_extension_type_or_storage(&ext.name, &storage, ext.metadata.as_deref()) {\n                    Some(typ) => DataType::Extension(typ, Box::new(storage)),\n                    None => storage,","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-core/src/datatypes/field.rs#L259-L295","documentation":"DataType::from_arrow converts an Arrow schema type to a Polars DataType. When the 'dtype-struct' cargo feature is disabled, encountering ArrowDataType::Struct panics because Polars cannot represent struct data without that feature.","triggerScenarios":"Reading Arrow/Parquet/IPC data containing a Struct column into a Polars build compiled without the 'dtype-struct' feature.","commonSituations":"Custom or minimal Polars builds (embedded/WASM) with trimmed feature flags encountering nested struct data at runtime.","solutions":["Rebuild/choose a Polars build with the 'dtype-struct' feature enabled","Use a prebuilt full-featured Polars wheel/package instead of a minimal build","Flatten the struct data upstream (in Arrow) before reading"],"exampleFix":"// Cargo.toml\n// before\npolars = { version = \"x\", features = [\"lazy\"] }\n// after\npolars = { version = \"x\", features = [\"lazy\", \"dtype-struct\"] }","handlingStrategy":"type-guard","validationCode":"# Rust build check\ncfg!(feature = \"dtype-struct\"); // gate struct-data ingestion on this","typeGuard":"fn supports_structs() -> bool { cfg!(feature = \"dtype-struct\") }","tryCatchPattern":"let dt = std::panic::catch_unwind(|| DataType::from_arrow(&arrow_dt, md));\nif dt.is_err() { /* fall back to flattened schema or error out clearly */ }","preventionTips":["Pin feature flags matching your data's schema when building Polars from source","Prefer official wheels with default features for nested data","Inspect Arrow schema before ingestion in minimal builds"],"tags":["polars","rust","feature-flags","arrow"],"backgroundTag":"feature-not-enabled","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}