{"record":{"id":"7ec43da712e54758","repo":"nautechsystems/nautilus_trader","slug":"failed-to-parse-order-report-for-e","errorCode":null,"errorMessage":"Failed to parse order report for {}: {e}","messagePattern":"Failed to parse order report for (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/betfair/src/execution.rs","lineNumber":3827,"sourceCode":"            };\n\n            let response = list_current_orders_with_retry(\n                http_client,\n                &params,\n                stream_session,\n                session_refresh,\n            )\n            .await?;\n            let page_size = response.current_orders.len() as u32;\n\n            if response.more_available && page_size == 0 {\n                anyhow::bail!(\"listCurrentOrders returned an empty page with moreAvailable=true\");\n            }\n\n            for order in &response.current_orders {\n                let mut report =\n                    parse_current_order_report(order, account_id, ts_init).map_err(|e| {\n                        anyhow::anyhow!(\"Failed to parse order report for {}: {e}\", order.bet_id)\n                    })?;\n\n                if let Some(resolution) = ocm_state.lock().resolve_order_owner(\n                    order.customer_order_ref.as_deref(),\n                    report.venue_order_id.as_str(),\n                ) {\n                    report.client_order_id = resolution.client_order_id();\n                }\n\n                let active_quantity = current_order_active_quantity(order).map_err(|e| {\n                    anyhow::anyhow!(\"Failed to parse active quantity for {}: {e}\", order.bet_id)\n                })?;\n                active_quantities.insert(order.bet_id.clone(), active_quantity);\n                reports.push(report);\n            }\n\n            if !response.more_available {\n                break;","sourceCodeStart":3809,"sourceCodeEnd":3845,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/betfair/src/execution.rs#L3809-L3845","documentation":"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.","triggerScenarios":"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.","commonSituations":"Betfair API schema changes or new/unexpected order statuses; corrupted or unusual order state on the account; locale/formatting differences in numeric fields.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match client.generate_order_status_reports().await {\n    Ok(reports) => apply(reports),\n    Err(e) if e.to_string().contains(\"Failed to parse order report\") => {\n        tracing::error!(\"reconciliation parse failure: {e:#}\"); // inspect raw payload, upgrade adapter\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["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."],"tags":["reconciliation","parsing","betfair"],"backgroundTag":"unexpected-api-response-shape","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"}