{"record":{"id":"7a18df58efa4a1f4","repo":"nautechsystems/nautilus_trader","slug":"listcurrentorders-returned-an-empty-page-with-more","errorCode":null,"errorMessage":"listCurrentOrders returned an empty page with moreAvailable=true","messagePattern":"listCurrentOrders returned an empty page with moreAvailable=true","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/betfair/src/execution.rs","lineNumber":3821,"sourceCode":"                customer_strategy_refs: None,\n                date_range: None,\n                order_by: None,\n                sort_dir: None,\n                from_record: (from_record > 0).then_some(from_record),\n                record_count: None,\n            };\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                })?;","sourceCodeStart":3803,"sourceCodeEnd":3839,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/betfair/src/execution.rs#L3803-L3839","documentation":"While syncing open orders via listCurrentOrders, the client treats an empty page that still reports moreAvailable=true as a protocol violation: it would loop forever fetching a next page with no progress. It bails with this error instead of looping or silently truncating.","triggerScenarios":"A listCurrentOrders REST call response where current_orders is empty and more_available is true during the open-order reconciliation/poll loop.","commonSituations":"Transient Betfair API inconsistency; a proxy or gateway returning malformed/empty bodies with stale pagination flags; Betfair API-side paging bugs near page boundaries.","solutions":["Retry the sync; this is often transient — check Betfair API status if it repeats","Log the raw response and check for proxies/gateways rewriting the response body","Update the adapter / check for Betfair API changes; report a bug if reproducible"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match sync_open_orders().await {\n    Err(e) if e.to_string().contains(\"empty page with moreAvailable=true\") => {\n        tokio::time::sleep(Duration::from_secs(1)).await;\n        // retry up to N times before failing the reconciliation\n    }\n    other => other?,\n}","preventionTips":["Implement bounded retries with backoff around open-order reconciliation","Monitor Betfair API status for incidents affecting listCurrentOrders","Avoid custom proxies that may alter paginated response bodies; alert on repeated occurrences"],"tags":["betfair","pagination","api","sync"],"backgroundTag":"unexpected-response-shape","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"}