nautechsystems/nautilus_trader · error

listCurrentOrders returned an empty page with moreAvailable=

Error message

listCurrentOrders returned an empty page with moreAvailable=true

What it means

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.

Source

Thrown at crates/adapters/betfair/src/execution.rs:3821

                customer_strategy_refs: None,
                date_range: None,
                order_by: None,
                sort_dir: None,
                from_record: (from_record > 0).then_some(from_record),
                record_count: None,
            };

            let response = list_current_orders_with_retry(
                http_client,
                &params,
                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)
                })?;

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Retry the sync; this is often transient — check Betfair API status if it repeats
  2. Log the raw response and check for proxies/gateways rewriting the response body
  3. Update the adapter / check for Betfair API changes; report a bug if reproducible
Defensive patterns

Strategy: retry

Try / catch

match sync_open_orders().await {
    Err(e) if e.to_string().contains("empty page with moreAvailable=true") => {
        tokio::time::sleep(Duration::from_secs(1)).await;
        // retry up to N times before failing the reconciliation
    }
    other => other?,
}

Prevention

When it happens

Trigger: A listCurrentOrders REST call response where current_orders is empty and more_available is true during the open-order reconciliation/poll loop.

Common situations: Transient Betfair API inconsistency; a proxy or gateway returning malformed/empty bodies with stale pagination flags; Betfair API-side paging bugs near page boundaries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/7a18df58efa4a1f4. Report an issue: GitHub.