nautechsystems/nautilus_trader · error

order list {} has {} orders and {} reports

Error message

order list {} has {} orders and {} reports

What it means

The cancel order-list response carried an empty orders array, or its orders and orderReports arrays differ in length — each order in the list must have exactly one corresponding order report for the adapter to build PreparedCancel entries. The mismatch means the exchange response is internally inconsistent.

Source

Thrown at crates/adapters/binance/src/spot/execution.rs:2546

fn prepare_cancel_order_list(
    response: BinanceCancelOrderListResponse,
    order_ids: &mut AHashSet<(InstrumentId, i64)>,
    client_order_ids: &mut AHashSet<ClientOrderId>,
    prepared: &mut Vec<PreparedCancelOrder>,
) -> anyhow::Result<()> {
    anyhow::ensure!(
        response.order_list_id >= 0 && !response.symbol.is_empty(),
        "order list has an invalid list ID or empty symbol",
    );
    anyhow::ensure!(
        response.list_status_type == SbeListStatusType::AllDone
            && response.list_order_status == SbeListOrderStatus::AllDone,
        "order list {} was not fully canceled: status={:?}, order_status={:?}",
        response.order_list_id,
        response.list_status_type,
        response.list_order_status,
    );
    anyhow::ensure!(
        !response.orders.is_empty() && response.orders.len() == response.order_reports.len(),
        "order list {} has {} orders and {} reports",
        response.order_list_id,
        response.orders.len(),
        response.order_reports.len(),
    );

    let mut list_orders = AHashMap::with_capacity(response.orders.len());
    for order in response.orders {
        anyhow::ensure!(
            order.symbol == response.symbol,
            "order list {} contains order {} for symbol {}, expected {}",
            response.order_list_id,
            order.order_id,
            order.symbol,
            response.symbol,
        );
        anyhow::ensure!(

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Update the Binance adapter to the latest version so the SBE schema matches the exchange's current protocol
  2. Dump the raw response bytes to verify whether orders and orderReports genuinely differ upstream
  3. Retry the cancel; one-off inconsistencies are transient
  4. If reproducible, file a bug with the raw payload and adapter version
Defensive patterns

Strategy: validation

Validate before calling

// Before consuming the response, sanity-check pairing yourself
if resp.orders.is_empty() || resp.orders.len() != resp.order_reports.len() {
    // skip/fallback rather than process
}

Try / catch

match result {
    Err(e) if e.to_string().contains("orders and") => {
        tracing::warn!("order list response inconsistent; falling back to open-orders query");
        reconcile_from_open_orders().await?;
    },
    other => other?,
}

Prevention

When it happens

Trigger: cancel_all_orders receives a BinanceCancelOrderListResponse where orders.is_empty() or orders.len() != order_reports.len(), e.g. a response decoded from a schema mismatch between adapter expectations and exchange payload.

Common situations: Adapter/SBE schema drift after a Binance protocol update; truncated or corrupted response; exchange bug returning reports for a subset of orders.

Related errors


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