{"record":{"id":"804bc90751a0773c","repo":"nautechsystems/nautilus_trader","slug":"filter-callable-filter-callable-requires-the-i","errorCode":null,"errorMessage":"filter_callable {filter_callable:?} requires the Interactive Brokers adapter to be built with the python feature","messagePattern":"filter_callable (.+?) requires the Interactive Brokers adapter to be built with the python feature","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/interactive_brokers/src/providers/instruments.rs","lineNumber":1805,"sourceCode":"                        )\n                    })?;\n                let callable = PyModule::import(py, module_name)\n                    .map_err(|e| anyhow::anyhow!(\"Failed to import {module_name}: {e}\"))?\n                    .getattr(callable_name)\n                    .map_err(|e| anyhow::anyhow!(\"Failed to resolve {filter_callable}: {e}\"))?;\n                let py_instrument = instrument_any_to_pyobject(py, instrument.clone())\n                    .map_err(|e| anyhow::anyhow!(\"Failed to convert instrument to Python: {e}\"))?;\n                callable\n                    .call1((py_instrument,))\n                    .and_then(|result| result.extract::<bool>())\n                    .map_err(|e| anyhow::anyhow!(\"filter_callable {filter_callable} failed: {e}\"))\n            })\n        }\n\n        #[cfg(not(feature = \"python\"))]\n        {\n            let _ = instrument;\n            anyhow::bail!(\n                \"filter_callable {filter_callable:?} requires the Interactive Brokers adapter to be built with the python feature\"\n            );\n        }\n    }\n\n    /// Batch load multiple instrument IDs.\n    ///\n    /// This method fetches and caches contract details for multiple instrument IDs in parallel.\n    ///\n    /// # Arguments\n    ///\n    /// * `client` - The IB API client\n    /// * `instrument_ids` - Vector of instrument IDs to load\n    /// * `filters` - Optional filters to apply (not yet implemented, reserved for future use)\n    ///\n    /// # Returns\n    ///\n    /// Returns a vector of successfully loaded instrument IDs.","sourceCodeStart":1787,"sourceCodeEnd":1823,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/interactive_brokers/src/providers/instruments.rs#L1787-L1823","documentation":"The adapter supports an optional Python filter_callable to accept/reject instruments during contract detail processing, but that functionality only exists when the adapter is compiled with the `python` feature. When built without it, calling the filter unconditionally fails with this error instead of silently ignoring the filter.","triggerScenarios":"process_contract_detail processes a contract while a filter_callable is configured, and the binary/library was compiled without feature \"python\" (cfg(not(feature = \"python\")).","commonSituations":"Installing a prebuilt wheel or Rust build without the python feature and then supplying a Python filter callback in config; mixing a Python host app with a non-python-feature build.","solutions":["Reinstall/build the adapter with the python feature enabled (e.g. cargo build --features python or the python feature-enabled wheel).","Remove the filter_callable from configuration if Python filtering is not needed.","Verify the installed package actually includes the python feature (check build flags/docs).","Filter instruments before passing them to the adapter instead of via filter_callable."],"exampleFix":"// before: build without python feature\ncargo build -p nautilus-ib\ncargo build -p nautilus-ib --features python","handlingStrategy":"type-guard","validationCode":"#[cfg(not(feature = \"python\"))]\nfn python_filter_configured(filter: &Option<FilterCallable>) -> bool { filter.is_some() }\n// guard before config: if python_filter_configured(&cfg.filter) { rebuild with --features python }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Confirm build features before enabling python callbacks in config","Drop filter_callable config when not using python-feature builds","Pin builds/wheels with the features you rely on"],"tags":["feature-flag","python","interactive-brokers","build-config"],"backgroundTag":"feature-not-enabled","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}