{"record":{"id":"452f29c8e15443b9","repo":"pola-rs/polars","slug":"activate-binary-encoding-feature","errorCode":null,"errorMessage":"activate 'binary_encoding' feature","messagePattern":"activate 'binary_encoding' feature","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-ops/src/chunked_array/strings/namespace.rs","lineNumber":108,"sourceCode":"            },\n        };\n        polars_bail!(\n            ComputeError:\n            \"strict integer parsing failed for {} value(s): {}; error message for the \\\n            first shown value: '{}' (consider non-strict parsing)\",\n            n_failures,\n            some_failures.into_series().fmt_list(),\n            some_error_msg\n        );\n    }\n\n    Ok(out.into_series())\n}\n\npub trait StringNameSpaceImpl: AsString {\n    #[cfg(not(feature = \"binary_encoding\"))]\n    fn hex_decode(&self) -> PolarsResult<StringChunked> {\n        panic!(\"activate 'binary_encoding' feature\")\n    }\n\n    #[cfg(feature = \"binary_encoding\")]\n    fn hex_decode(&self, strict: bool) -> PolarsResult<BinaryChunked> {\n        let ca = self.as_string();\n        ca.as_binary().hex_decode(strict)\n    }\n\n    #[must_use]\n    #[cfg(feature = \"string_encoding\")]\n    fn hex_encode(&self) -> StringChunked {\n        let ca = self.as_string();\n        ca.apply_values(|s| hex::encode(s).into())\n    }\n\n    #[cfg(not(feature = \"binary_encoding\"))]\n    fn base64_decode(&self) -> PolarsResult<StringChunked> {\n        panic!(\"activate 'binary_encoding' feature\")","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-ops/src/chunked_array/strings/namespace.rs#L90-L126","documentation":"StringNameSpaceImpl::hex_decode is a stub when the binary_encoding feature is off: calling it panics with a message to recompile polars with 'binary_encoding' enabled, since hex decoding is feature-gated.","triggerScenarios":"Calling df.select(col('a').str.hex_decode()) (or .str.hex_decode equivalents) on a build without feature binary_encoding enabled.","commonSituations":"Using default Cargo features or a prebuilt wheel without binary_encoding; Python users on builds lacking the feature; transitive dependency pinning features off.","solutions":["Enable the feature: cargo add polars --features binary_encoding","In Python polars, install/upgrade to a build that includes hex decode support","Rebuild with cargo build --features binary_encoding","Check feature flags via polars metadata before using hex_decode"],"exampleFix":"// before\npolars = { version = \"0.x\" }\n// after\npolars = { version = \"0.x\", features = [\"binary_encoding\"] }","handlingStrategy":"type-guard","validationCode":"// Python\nimport polars as polars; print(polars.build_info()) # verify feature set\n// Rust: gate usage on cfg\ncfg!(feature = \"binary_encoding\")","typeGuard":"// Rust\n#[cfg(not(feature = \"binary_encoding\"))]\ncompile_error!(\"hex_decode requires the binary_encoding feature\");","tryCatchPattern":"std::panic::catch_unwind(|| frame.str_hex_decode()); // not recommended; enable the feature instead","preventionTips":["Declare required features in Cargo.toml of your crate","Check wheel/build feature lists before using str namespace hex/binary methods","Add compile-time cfg assertions for optional features"],"tags":["feature-flag","compile-time","strings","hex"],"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"}