{"record":{"id":"0195678e57792bc7","repo":"pola-rs/polars","slug":"activate-object","errorCode":null,"errorMessage":"activate object","messagePattern":"activate object","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-python/src/conversion/any_value.rs","lineNumber":595,"sourceCode":"            let val = py_object_to_any_value(&v, strict, true, None)?;\n            let dtype = val.dtype();\n            keys.push(Field::new(key.as_ref().into(), dtype));\n            vals.push(val)\n        }\n        Ok(AnyValue::StructOwned(Box::new((vals, keys))))\n    }\n\n    fn get_object(ob: &Bound<'_, PyAny>, _strict: bool) -> PyResult<AnyValue<'static>> {\n        #[cfg(feature = \"object\")]\n        {\n            // This is slow, but hey don't use objects.\n            let v = &ObjectValue {\n                inner: ob.clone().unbind(),\n            };\n            Ok(AnyValue::ObjectOwned(OwnedObject(v.to_boxed())))\n        }\n        #[cfg(not(feature = \"object\"))]\n        panic!(\"activate object\")\n    }\n\n    /// Determine which conversion function to use for the given object.\n    ///\n    /// Note: This function is only ran if the object's type is not already in the\n    /// lookup table.\n    fn get_conversion_function(ob: &Bound<'_, PyAny>, allow_object: bool) -> PyResult<InitFn> {\n        let py = ob.py();\n        if ob.is_none() {\n            Ok(get_null)\n        }\n        // bool must be checked before int because Python bool is an instance of int.\n        else if ob.is_instance_of::<PyBool>() {\n            Ok(get_bool)\n        } else if ob.is_instance_of::<PyInt>() {\n            Ok(get_int)\n        } else if ob.is_instance_of::<PyFloat>() {\n            Ok(get_float)","sourceCodeStart":577,"sourceCodeEnd":613,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-python/src/conversion/any_value.rs#L577-L613","documentation":"`get_object` in crates/polars-python/src/conversion/any_value.rs converts a Polars AnyValue::Object to a Python object. The object feature is compile-time gated; when Polars is built without the 'object' feature, any attempt to convert an Object value panics with \"activate object\".","triggerScenarios":"Using Object dtype data (pl.Object, Python objects stored in a Series/DataFrame) with a polars build compiled without the 'object' feature — e.g. calling .to_pyarrow()/to_list/iteration over object columns.","commonSituations":"Installing a prebuilt polars wheel that excludes the object feature while user code stores arbitrary Python objects in DataFrames, or migrating from a build that had the feature to one that doesn't.","solutions":["Install/build polars with the object feature enabled (cargo build with --features object, or use the default pip wheel that includes it)","Remove Object dtype usage; store data as supported dtypes (e.g. Struct, List, or serialized strings)","Check polars.build_info()/feature flags of the installed wheel"],"exampleFix":"# before\ns = pl.Series(\"objs\", [MyClass(), MyClass()])  # polars built without object feature\n# after\ns = pl.Series(\"objs\", [o.to_dict() for o in items], dtype=pl.Struct)","handlingStrategy":"type-guard","validationCode":"import polars\nassert \"object\" in polars.build_info()[\"features\"], \"polars built without object feature\"\nassert df.schema[\"col\"] != pl.Object, \"object column present but object feature unavailable\"","typeGuard":"def object_feature_available() -> bool:\n    import polars\n    return \"object\" in polars.build_info()[\"features\"]","tryCatchPattern":"try:\n    values = df[\"col\"].to_list()\nexcept pl.exceptions.PanicException as e:\n    if \"activate object\" in str(e):\n        raise RuntimeError(\"polars built without the object feature; avoid Object dtype\") from e\n    raise","preventionTips":["Avoid pl.Object dtype unless you specifically need arbitrary Python objects","Verify wheel feature flags after installing polars","Store structured data as Struct/List dtypes instead of Python objects"],"tags":["python","object-dtype","feature-flag","panic"],"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"}