nautechsystems/nautilus_trader · error

order list {} contains order {} for symbol {}, expected {}

Error message

order list {} contains order {} for symbol {}, expected {}

What it means

During cancel-all-orders handling, BinanceTrader validates a cancel-open-orders response for an order list. Each child order in the payload must trade the same symbol as the list itself; this invariant check fires when a child order's symbol differs from the response's top-level symbol, indicating a corrupted or mis-decoded Binance SBE payload.

Source

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

    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!(
            list_orders.insert(order.order_id, order).is_none(),
            "order list {} contains a duplicate order ID",
            response.order_list_id,
        );
    }

    for report in response.order_reports {
        anyhow::ensure!(
            report.order_list_id == Some(response.order_list_id),
            "order {} reports order-list ID {:?}, expected {}",

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Update the nautilus_binance adapter and nautilus_trader to the latest version so the SBE schema matches Binance's current one
  2. Log the full raw response (order_list_id, symbol, orders[]) and report it to the adapter maintainers if the payload genuinely mixes symbols
  3. Re-run the cancel-all request; a transient decode corruption may not reproduce
  4. Verify no proxy/gateway is transforming or truncating the binary SBE response
Defensive patterns

Strategy: validation

Validate before calling

let bad: Vec<_> = response.orders.iter().filter(|o| o.symbol != response.symbol).collect();
if !bad.is_empty() {
    return Err(anyhow!("order list {} has {} orders with mismatched symbol", response.order_list_id, bad.len()));
}

Type guard

fn orders_match_list_symbol(resp: &BinanceCancelOrderListResponse) -> bool {
    resp.orders.iter().all(|o| o.symbol == resp.symbol) && !resp.symbol.is_empty()
}

Try / catch

match prepare_cancel_all_orders(...) {
    Ok(prepared) => handle(prepared),
    Err(e) if e.to_string().contains("expected") => log::error!("malformed order-list payload: {e}"),
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Binance cancel-open-orders (DELETE /api/v3/openOrders) returns an OrderList response whose orders[] array contains an order with a symbol different from response.symbol — typically only possible via a decoding bug, protocol change, or corrupted/interleaved SBE data.

Common situations: Binance API schema/SBE schema changes after an exchange update; using an adapter version mismatched with the current Binance spot SBE schema; corrupted websocket/REST payloads; proxy or middleware mangling binary responses.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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