nautechsystems/nautilus_trader · error

cancel-all response has an invalid order ID, symbol, or orig

Error message

cancel-all response has an invalid order ID, symbol, or original client order ID

What it means

prepare_cancel_order validates that each cancel-all child response has a non-negative order_id, a non-empty symbol, and a non-empty original client order ID before building a PreparedCancelOrder. Any of these fields missing or invalid means Binance returned a response the adapter cannot map back to a Nautilus order.

Source

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

        list_orders.len(),
    );
    Ok(())
}

fn prepare_cancel_order(
    response: &BinanceCancelOrderResponse,
    order_list: bool,
    order_ids: &mut AHashSet<(InstrumentId, i64)>,
    client_order_ids: &mut AHashSet<ClientOrderId>,
    prepared: &mut Vec<PreparedCancelOrder>,
) -> anyhow::Result<()> {
    anyhow::ensure!(
        response.order_id >= 0
            && !response.symbol.is_empty()
            && !response.orig_client_order_id.is_empty(),
        "cancel-all response has an invalid order ID, symbol, or original client order ID",
    );
    anyhow::ensure!(
        response.status == SbeOrderStatus::Canceled,
        "order {} reports status {:?}, expected Canceled",
        response.order_id,
        response.status,
    );
    let client_order_id = decode_client_order_id(
        &response.orig_client_order_id,
        BINANCE_NAUTILUS_SPOT_BROKER_ID,
    )?;
    let instrument_id = InstrumentId::new(response.symbol.as_str().into(), *BINANCE_VENUE);
    anyhow::ensure!(
        order_ids.insert((instrument_id, response.order_id)),
        "cancel-all response contains duplicate order ID {} for {}",
        response.order_id,
        instrument_id,
    );
    anyhow::ensure!(
        client_order_ids.insert(client_order_id),

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Check the order still exists and is open before canceling (order may already be filled/canceled)
  2. Retry the cancel and inspect the full Binance response
  3. Verify the adapter and Binance SBE schema versions match
  4. Cancel orders individually to get per-order error details
Defensive patterns

Strategy: validation

Validate before calling

if order_id < 0 || symbol.is_empty() { return Err(...); } // check venue order state before issuing cancel

Try / catch

match result { Err(e) if e.to_string().contains("invalid order ID, symbol") => reconcile_order_state(), Err(e) => return Err(e), Ok(_) => continue }

Prevention

When it happens

Trigger: Cancel-all or cancel-order-list responses where the SBE-decoded BinanceCancelOrderResponse contains order_id < 0, an empty symbol, or empty orig_client_order_id — typically when Binance rejects/echoes an error-shaped record inside the batch.

Common situations: Binance-side rejection of the cancel batch, API schema changes, or an order already canceled/expired so the venue returns placeholder values.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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