{"record":{"id":"5e97a2413321c15a","repo":"nautechsystems/nautilus_trader","slug":"python-fillmodel-method-name-failed-e","errorCode":null,"errorMessage":"Python FillModel.{method_name} failed: {e}","messagePattern":"Python FillModel\\.(.+?) failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/execution/src/python/fill.rs","lineNumber":145,"sourceCode":"                (instrument, order, best_bid, best_ask),\n            )?\n            .extract()\n            .map_err(|e| anyhow::anyhow!(\"{e}\"))\n        })\n        .map_err(|e| {\n            anyhow::anyhow!(\"Python FillModel.get_orderbook_for_fill_simulation failed: {e}\")\n        })\n    }\n}\n\nfn call_bool_method(obj: &Py<PyAny>, method_name: &str) -> anyhow::Result<bool> {\n    Python::attach(|py| -> anyhow::Result<bool> {\n        obj.bind(py)\n            .call_method0(method_name)?\n            .extract()\n            .map_err(|e| anyhow::anyhow!(\"{e}\"))\n    })\n    .map_err(|e| anyhow::anyhow!(\"Python FillModel.{method_name} failed: {e}\"))\n}\n\n/// Extracts a Python fill model object into a Rust [`FillModelAny`].\n///\n/// # Errors\n///\n/// Returns an error if `obj` is not a supported built-in fill model binding.\npub fn pyobject_to_fill_model_any(obj: &Bound<'_, PyAny>) -> PyResult<FillModelAny> {\n    if let Ok(m) = obj.extract::<DefaultFillModel>() {\n        return Ok(FillModelAny::Default(m));\n    }\n\n    if let Ok(m) = obj.extract::<BestPriceFillModel>() {\n        return Ok(FillModelAny::BestPrice(m));\n    }\n\n    if let Ok(m) = obj.extract::<OneTickSlippageFillModel>() {\n        return Ok(FillModelAny::OneTickSlippage(m));","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/execution/src/python/fill.rs#L127-L163","documentation":"Wraps any failure of the Python FillModel boolean method call (is_limit_filled / is_slipped) with a prefix naming the exact method via `{method_name}`. The inner `{e}` carries the Python exception or extraction failure.","triggerScenarios":"Any error propagated from call_bool_method when invoking is_limit_filled or is_slipped on the Python fill model.","commonSituations":"Custom fill models with drifted signatures; exceptions raised on particular order states; non-boolean return values.","solutions":["Unwrap the anyhow chain to read the original Python traceback for the named method","Fix the Python implementation of the named method to return a bool","Align with the current NautilusTrader FillModel interface","Test both methods through the Rust-facing integration before deployment"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    filled = fill_model.is_limit_filled(order)\nexcept Exception as e:\n    log.error(f\"FillModel.is_limit_filled failed: {e}\")\n    filled = False","preventionTips":["Note the method name in the error message and test that exact method","Keep model return types plain and version-aligned","Log the full error chain for the Python traceback"],"tags":["python-interop","fill-model","error-wrapping"],"backgroundTag":"api-error-response","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}