{"record":{"id":"7131f0e111e42f5c","repo":"nautechsystems/nautilus_trader","slug":"cancel-all-response-has-an-invalid-order-id-symbo","errorCode":null,"errorMessage":"cancel-all response has an invalid order ID, symbol, or original client order ID","messagePattern":"cancel-all response has an invalid order ID, symbol, or original client order ID","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/execution.rs","lineNumber":2617,"sourceCode":"        list_orders.len(),\n    );\n    Ok(())\n}\n\nfn prepare_cancel_order(\n    response: &BinanceCancelOrderResponse,\n    order_list: bool,\n    order_ids: &mut AHashSet<(InstrumentId, i64)>,\n    client_order_ids: &mut AHashSet<ClientOrderId>,\n    prepared: &mut Vec<PreparedCancelOrder>,\n) -> anyhow::Result<()> {\n    anyhow::ensure!(\n        response.order_id >= 0\n            && !response.symbol.is_empty()\n            && !response.orig_client_order_id.is_empty(),\n        \"cancel-all response has an invalid order ID, symbol, or original client order ID\",\n    );\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),","sourceCodeStart":2599,"sourceCodeEnd":2635,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/spot/execution.rs#L2599-L2635","documentation":"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.","triggerScenarios":"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.","commonSituations":"Binance-side rejection of the cancel batch, API schema changes, or an order already canceled/expired so the venue returns placeholder values.","solutions":["Check the order still exists and is open before canceling (order may already be filled/canceled)","Retry the cancel and inspect the full Binance response","Verify the adapter and Binance SBE schema versions match","Cancel orders individually to get per-order error details"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if order_id < 0 || symbol.is_empty() { return Err(...); } // check venue order state before issuing cancel","typeGuard":null,"tryCatchPattern":"match result { Err(e) if e.to_string().contains(\"invalid order ID, symbol\") => reconcile_order_state(), Err(e) => return Err(e), Ok(_) => continue }","preventionTips":["Confirm orders are open via order status reports before canceling","Track fills/cancels locally to avoid canceling terminal orders","Keep Binance adapter schema handling current"],"tags":["binance","cancel-order","response-validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}