{"record":{"id":"07b85c266c6f6947","repo":"nautechsystems/nautilus_trader","slug":"order-list-contains-order-for-symbol-exp","errorCode":null,"errorMessage":"order list {} contains order {} for symbol {}, expected {}","messagePattern":"order list (.+?) contains order (.+?) for symbol (.+?), expected (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/execution.rs","lineNumber":2556,"sourceCode":"    anyhow::ensure!(\n        response.list_status_type == SbeListStatusType::AllDone\n            && response.list_order_status == SbeListOrderStatus::AllDone,\n        \"order list {} was not fully canceled: status={:?}, order_status={:?}\",\n        response.order_list_id,\n        response.list_status_type,\n        response.list_order_status,\n    );\n    anyhow::ensure!(\n        !response.orders.is_empty() && response.orders.len() == response.order_reports.len(),\n        \"order list {} has {} orders and {} reports\",\n        response.order_list_id,\n        response.orders.len(),\n        response.order_reports.len(),\n    );\n\n    let mut list_orders = AHashMap::with_capacity(response.orders.len());\n    for order in response.orders {\n        anyhow::ensure!(\n            order.symbol == response.symbol,\n            \"order list {} contains order {} for symbol {}, expected {}\",\n            response.order_list_id,\n            order.order_id,\n            order.symbol,\n            response.symbol,\n        );\n        anyhow::ensure!(\n            list_orders.insert(order.order_id, order).is_none(),\n            \"order list {} contains a duplicate order ID\",\n            response.order_list_id,\n        );\n    }\n\n    for report in response.order_reports {\n        anyhow::ensure!(\n            report.order_list_id == Some(response.order_list_id),\n            \"order {} reports order-list ID {:?}, expected {}\",","sourceCodeStart":2538,"sourceCodeEnd":2574,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/spot/execution.rs#L2538-L2574","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Update the nautilus_binance adapter and nautilus_trader to the latest version so the SBE schema matches Binance's current one","Log the full raw response (order_list_id, symbol, orders[]) and report it to the adapter maintainers if the payload genuinely mixes symbols","Re-run the cancel-all request; a transient decode corruption may not reproduce","Verify no proxy/gateway is transforming or truncating the binary SBE response"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let bad: Vec<_> = response.orders.iter().filter(|o| o.symbol != response.symbol).collect();\nif !bad.is_empty() {\n    return Err(anyhow!(\"order list {} has {} orders with mismatched symbol\", response.order_list_id, bad.len()));\n}","typeGuard":"fn orders_match_list_symbol(resp: &BinanceCancelOrderListResponse) -> bool {\n    resp.orders.iter().all(|o| o.symbol == resp.symbol) && !resp.symbol.is_empty()\n}","tryCatchPattern":"match prepare_cancel_all_orders(...) {\n    Ok(prepared) => handle(prepared),\n    Err(e) if e.to_string().contains(\"expected\") => log::error!(\"malformed order-list payload: {e}\"),\n    Err(e) => return Err(e),\n}","preventionTips":["Keep the Binance adapter updated with Binance SBE schema releases","Log raw payloads on any order-list validation failure for post-mortem","Avoid custom proxies in front of Binance REST/SBE endpoints"],"tags":["binance","validation","invariant-violation","order-list"],"backgroundTag":"internal-invariant-violation","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"}