nautechsystems/nautilus_trader · error
Python FillModel.{method_name} failed: {e}
Error message
Python FillModel.{method_name} failed: {e} What it means
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.
Source
Thrown at crates/execution/src/python/fill.rs:145
(instrument, order, best_bid, best_ask),
)?
.extract()
.map_err(|e| anyhow::anyhow!("{e}"))
})
.map_err(|e| {
anyhow::anyhow!("Python FillModel.get_orderbook_for_fill_simulation failed: {e}")
})
}
}
fn call_bool_method(obj: &Py<PyAny>, method_name: &str) -> anyhow::Result<bool> {
Python::attach(|py| -> anyhow::Result<bool> {
obj.bind(py)
.call_method0(method_name)?
.extract()
.map_err(|e| anyhow::anyhow!("{e}"))
})
.map_err(|e| anyhow::anyhow!("Python FillModel.{method_name} failed: {e}"))
}
/// Extracts a Python fill model object into a Rust [`FillModelAny`].
///
/// # Errors
///
/// Returns an error if `obj` is not a supported built-in fill model binding.
pub fn pyobject_to_fill_model_any(obj: &Bound<'_, PyAny>) -> PyResult<FillModelAny> {
if let Ok(m) = obj.extract::<DefaultFillModel>() {
return Ok(FillModelAny::Default(m));
}
if let Ok(m) = obj.extract::<BestPriceFillModel>() {
return Ok(FillModelAny::BestPrice(m));
}
if let Ok(m) = obj.extract::<OneTickSlippageFillModel>() {
return Ok(FillModelAny::OneTickSlippage(m));View on GitHub (pinned to 18893faf8b)
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
Defensive patterns
Strategy: try-catch
Try / catch
try:
filled = fill_model.is_limit_filled(order)
except Exception as e:
log.error(f"FillModel.is_limit_filled failed: {e}")
filled = False Prevention
- 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
When it happens
Trigger: Any error propagated from call_bool_method when invoking is_limit_filled or is_slipped on the Python fill model.
Common situations: Custom fill models with drifted signatures; exceptions raised on particular order states; non-boolean return values.
Related errors
- Python FillModel.fill_limit_inside_spread failed: {e}
- Python FillModel.get_orderbook_for_fill_simulation failed: {
- Python FeeModel.get_commission_with_context failed: {e}
- {e}
- Failed to decode instrument {instrument_id}: {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/5e97a2413321c15a.
Report an issue: GitHub.