nautechsystems/nautilus_trader · error
cancel-all response contains duplicate order ID {} for {}
Error message
cancel-all response contains duplicate order ID {} for {} What it means
During cancel-all/cancel-list processing, prepare_cancel_order de-duplicates the (instrument_id, order_id) pairs and client order IDs collected from child reports. A duplicate order ID for the same instrument means Binance reported the same order twice in one response, which the adapter treats as a protocol violation rather than silently dropping it.
Source
Thrown at crates/adapters/binance/src/spot/execution.rs:2634
);
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),
"cancel-all response contains duplicate client order ID {client_order_id}",
);
prepared.push(PreparedCancelOrder {
venue_order_id: VenueOrderId::new(response.order_id.to_string()),
transaction_time: response.transact_time,
client_order_id,
instrument_id,
order_list,
});
Ok(())
}
fn dispatch_order_list_canceled(
canceled_order: &PreparedCancelOrder,
emitter: &ExecutionEventEmitter,
account_id: AccountId,
state: &WsDispatchState,View on GitHub (pinned to 18893faf8b)
Solutions
- Retry the cancel operation once to get a clean response
- Deduplicate orders before issuing cancel-all by tracking open order IDs
- Report reproducible duplicate responses to the adapter maintainers
- Use individual cancels as a fallback
Defensive patterns
Strategy: retry
Try / catch
if let Err(e) = result { if e.to_string().contains("duplicate order ID") { retry_once_then_fallback_to_single_cancels(); } } Prevention
- Deduplicate open orders before issuing cancel-all
- Keep one authoritative source of open order IDs per venue
- Report reproducible duplicate venue responses upstream
When it happens
Trigger: A Binance cancel-all/cancel-list response containing the same (symbol, order_id) pair or the same orig_client_order_id more than once — indicative of a malformed or duplicated batch response.
Common situations: Very rare; typically seen during Binance API anomalies, SBE decode issues, or when replaying/retrying a cancel request that was partially applied.
Related errors
- order list {} is missing {} child reports
- cancel-all response has an invalid order ID, symbol, or orig
- WS cancel order failed: {e}
- WS cancel order failed: {e}
- cancel-all response contains an order for a different instru
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/8e2b279a79928aff.
Report an issue: GitHub.