{"record":{"id":"1aa86ba57b0ed08c","repo":"nautechsystems/nautilus_trader","slug":"failed-to-resolve-filter-callable-e","errorCode":null,"errorMessage":"Failed to resolve {filter_callable}: {e}","messagePattern":"Failed to resolve (.+?): (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/interactive_brokers/src/providers/instruments.rs","lineNumber":1792,"sourceCode":"            return Ok(true);\n        };\n\n        #[cfg(feature = \"python\")]\n        {\n            use nautilus_model::python::instruments::instrument_any_to_pyobject;\n            use pyo3::{prelude::*, types::PyModule};\n\n            Python::attach(|py| {\n                let (module_name, callable_name) =\n                    filter_callable.rsplit_once('.').ok_or_else(|| {\n                        anyhow::anyhow!(\n                            \"Invalid filter_callable path {filter_callable:?}; expected module.callable\"\n                        )\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","sourceCodeStart":1774,"sourceCodeEnd":1810,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/interactive_brokers/src/providers/instruments.rs#L1774-L1810","documentation":"The module imported successfully but getattr(callable_name) failed, so the named attribute does not exist on the module (or is not accessible). The error wraps the Python AttributeError with the original filter_callable for context.","triggerScenarios":"filter_callable points at a module where the function name is misspelled, renamed, or the name refers to a non-callable attribute; e.g. 'mypackage.filters.skipFX' when the function is 'skip_fx'.","commonSituations":"Version drift — the callable was renamed or moved to another module; case-sensitivity mistakes; passing a class or variable instead of a function.","solutions":["Verify the attribute exists: 'python -c \"import m; print(m.<callable_name>)\"'","Fix spelling/casing in the filter_callable string to match the actual function name","Update the path after any rename/refactor of the filter module"],"exampleFix":"// before\nfilter_callable = \"mypackage.filters.skipFX\"\n// after\nfilter_callable = \"mypackage.filters.skip_fx\"","handlingStrategy":"validation","validationCode":"import importlib\nmod = importlib.import_module(module_name)\nassert callable(getattr(mod, func_name)), f\"{filter_callable} is not callable\"","typeGuard":"fn check(mod: &str, func: &str) { debug_assert!(PY_MODS.get(mod).map(|m| m.has_attr(func)).unwrap_or(false)); }","tryCatchPattern":"try:\n    process_contract_detail(details, filter_callable)\nexcept Exception as e:\n    if \"Failed to resolve\" in str(e):\n        print(\"callable renamed or missing:\", e)\n    else:\n        raise","preventionTips":["Verify the attribute exists on the module after any rename/refactor","Use a smoke test that resolves every configured filter_callable at startup","Match exact spelling and casing of the function name"],"tags":["python","attribute","configuration","typo"],"backgroundTag":"invalid-argument-value","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"}