{"record":{"id":"8e2b279a79928aff","repo":"nautechsystems/nautilus_trader","slug":"cancel-all-response-contains-duplicate-order-id","errorCode":null,"errorMessage":"cancel-all response contains duplicate order ID {} for {}","messagePattern":"cancel-all response contains duplicate order ID (.+?) for (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/execution.rs","lineNumber":2634,"sourceCode":"    );\n    anyhow::ensure!(\n        response.status == SbeOrderStatus::Canceled,\n        \"order {} reports status {:?}, expected Canceled\",\n        response.order_id,\n        response.status,\n    );\n    let client_order_id = decode_client_order_id(\n        &response.orig_client_order_id,\n        BINANCE_NAUTILUS_SPOT_BROKER_ID,\n    )?;\n    let instrument_id = InstrumentId::new(response.symbol.as_str().into(), *BINANCE_VENUE);\n    anyhow::ensure!(\n        order_ids.insert((instrument_id, response.order_id)),\n        \"cancel-all response contains duplicate order ID {} for {}\",\n        response.order_id,\n        instrument_id,\n    );\n    anyhow::ensure!(\n        client_order_ids.insert(client_order_id),\n        \"cancel-all response contains duplicate client order ID {client_order_id}\",\n    );\n    prepared.push(PreparedCancelOrder {\n        venue_order_id: VenueOrderId::new(response.order_id.to_string()),\n        transaction_time: response.transact_time,\n        client_order_id,\n        instrument_id,\n        order_list,\n    });\n    Ok(())\n}\n\nfn dispatch_order_list_canceled(\n    canceled_order: &PreparedCancelOrder,\n    emitter: &ExecutionEventEmitter,\n    account_id: AccountId,\n    state: &WsDispatchState,","sourceCodeStart":2616,"sourceCodeEnd":2652,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/spot/execution.rs#L2616-L2652","documentation":"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.","triggerScenarios":"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.","commonSituations":"Very rare; typically seen during Binance API anomalies, SBE decode issues, or when replaying/retrying a cancel request that was partially applied.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if let Err(e) = result { if e.to_string().contains(\"duplicate order ID\") { retry_once_then_fallback_to_single_cancels(); } }","preventionTips":["Deduplicate open orders before issuing cancel-all","Keep one authoritative source of open order IDs per venue","Report reproducible duplicate venue responses upstream"],"tags":["binance","cancel-order","duplicate","response-validation"],"backgroundTag":"unexpected-response-shape","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}