pola-rs/polars · error

activate the 'object' feature to be able to load…

Error message

activate the 'object' feature to be able to load POLARS_EXTENSION_TYPE

What it means

When an Arrow field carries the POLARS_EXTENSION_TYPE extension metadata, DataType::from_arrow maps it to DataType::Object — but only if the 'object' feature is compiled in. Without it, reading such extension-typed data panics.

Solutions

  1. Enable the 'object' feature in the consuming Polars build
  2. Strip or rewrite the extension metadata in the source data so it reads as plain storage type
  3. Re-export the data without Object columns from the producing side

Example fix

// Cargo.toml
// before
polars = { version = "x", default-features = false, features = ["ipc"] }
// after
polars = { version = "x", default-features = false, features = ["ipc", "object"] }
Defensive patterns

Strategy: type-guard

Validate before calling

// check extension metadata before loading
if field.extension_name == "polars.extension" { assert!(cfg!(feature = "object")); }

Type guard

fn supports_object() -> bool { cfg!(feature = "object") }

Try / catch

match std::panic::catch_unwind(|| DataType::from_arrow(&arrow_dt, md)) {
    Ok(dt) => dt,
    Err(_) => return Err("rebuild with 'object' feature or strip extension metadata".into()),
}

Prevention

When it happens

Trigger: Reading Arrow IPC/Parquet data written by a Polars build with Object columns (extension metadata present) into a build without the 'object' feature.

Common situations: Cross-language or cross-build data exchange: a Polars build with object support saved data, a feature-trimmed build (e.g. WASM, embedded) reads it.

Related errors


AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18). Data as JSON: /api/errors/4d1b484e02836a5c. Report an issue: GitHub.

Appendix: source

Thrown at crates/polars-core/src/datatypes/field.rs:286

                }
            },

            #[cfg(feature = "dtype-struct")]
            ArrowDataType::Struct(fields) => {
                DataType::Struct(fields.iter().map(|fld| fld.into()).collect())
            },
            #[cfg(not(feature = "dtype-struct"))]
            ArrowDataType::Struct(_) => {
                panic!("activate the 'dtype-struct' feature to handle struct data types")
            },
            ArrowDataType::Extension(ext) if ext.name.as_str() == POLARS_OBJECT_EXTENSION_NAME => {
                #[cfg(feature = "object")]
                {
                    DataType::Object("object")
                }
                #[cfg(not(feature = "object"))]
                {
                    panic!("activate the 'object' feature to be able to load POLARS_EXTENSION_TYPE")
                }
            },
            #[cfg(feature = "dtype-extension")]
            ArrowDataType::Extension(ext) => {
                use crate::prelude::extension::get_extension_type_or_storage;
                let storage = DataType::from_arrow(&ext.inner, md);
                match get_extension_type_or_storage(&ext.name, &storage, ext.metadata.as_deref()) {
                    Some(typ) => DataType::Extension(typ, Box::new(storage)),
                    None => storage,
                }
            },
            #[cfg(feature = "dtype-decimal")]
            ArrowDataType::Decimal(precision, scale)
            | ArrowDataType::Decimal32(precision, scale)
            | ArrowDataType::Decimal64(precision, scale)
            | ArrowDataType::Decimal256(precision, scale) => DataType::Decimal(*precision, *scale),
            ArrowDataType::Utf8View | ArrowDataType::LargeUtf8 | ArrowDataType::Utf8 => {
                DataType::String

View on GitHub (pinned to fe841f959e)