nautechsystems/nautilus_trader · error
Failed to parse order report for {}: {e}
Error message
Failed to parse order report for {}: {e} What it means
When reconciling via listCurrentOrders, each raw Betfair CurrentOrderSummary must be converted into an internal order report. If parse_current_order_report fails for a given bet_id, the client wraps the error with the bet id to identify the offending order.
Source
Thrown at crates/adapters/betfair/src/execution.rs:3827
};
let response = list_current_orders_with_retry(
http_client,
¶ms,
stream_session,
session_refresh,
)
.await?;
let page_size = response.current_orders.len() as u32;
if response.more_available && page_size == 0 {
anyhow::bail!("listCurrentOrders returned an empty page with moreAvailable=true");
}
for order in &response.current_orders {
let mut report =
parse_current_order_report(order, account_id, ts_init).map_err(|e| {
anyhow::anyhow!("Failed to parse order report for {}: {e}", order.bet_id)
})?;
if let Some(resolution) = ocm_state.lock().resolve_order_owner(
order.customer_order_ref.as_deref(),
report.venue_order_id.as_str(),
) {
report.client_order_id = resolution.client_order_id();
}
let active_quantity = current_order_active_quantity(order).map_err(|e| {
anyhow::anyhow!("Failed to parse active quantity for {}: {e}", order.bet_id)
})?;
active_quantities.insert(order.bet_id.clone(), active_quantity);
reports.push(report);
}
if !response.more_available {
break;View on GitHub (pinned to 18893faf8b)
Solutions
- Log the raw CurrentOrderSummary JSON for the reported bet_id to see which field failed to parse.
- Update the parser (parse_current_order_report) to handle the new status/format encountered.
- Check for a nautilus_trader adapter update addressing Betfair API changes; retry reconciliation after transient issues.
Defensive patterns
Strategy: try-catch
Try / catch
match client.generate_order_status_reports().await {
Ok(reports) => apply(reports),
Err(e) if e.to_string().contains("Failed to parse order report") => {
tracing::error!("reconciliation parse failure: {e:#}"); // inspect raw payload, upgrade adapter
}
Err(e) => return Err(e),
} Prevention
- Keep the Betfair adapter and its parsers up to date with API changes.
- Log raw listCurrentOrders payloads at debug level for post-mortems.
- Handle unknown order statuses gracefully in reconciliation code.
When it happens
Trigger: A listCurrentOrders response contains a current order whose fields cannot be parsed (invalid price/size formats, unexpected order status, missing required fields) during reconciliation or generate_order_status_reports.
Common situations: Betfair API schema changes or new/unexpected order statuses; corrupted or unusual order state on the account; locale/formatting differences in numeric fields.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Cannot extract market ID from {instrument_id}
- Cannot extract selection ID from {instrument_id}
- missing persistence type for order update {}
- Failed to parse active quantity for {}: {e}
- failed to resolve positive quantity for current order {} (or
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/7ec43da712e54758.
Report an issue: GitHub.