{"record":{"id":"2b280e95a6f8993f","repo":"nautechsystems/nautilus_trader","slug":"order-list-has-orders-and-reports","errorCode":null,"errorMessage":"order list {} has {} orders and {} reports","messagePattern":"order list (.+?) has (.+?) orders and (.+?) reports","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/execution.rs","lineNumber":2546,"sourceCode":"fn prepare_cancel_order_list(\n    response: BinanceCancelOrderListResponse,\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_list_id >= 0 && !response.symbol.is_empty(),\n        \"order list has an invalid list ID or empty symbol\",\n    );\n    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!(","sourceCodeStart":2528,"sourceCodeEnd":2564,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/spot/execution.rs#L2528-L2564","documentation":"The cancel order-list response carried an empty orders array, or its orders and orderReports arrays differ in length — each order in the list must have exactly one corresponding order report for the adapter to build PreparedCancel entries. The mismatch means the exchange response is internally inconsistent.","triggerScenarios":"cancel_all_orders receives a BinanceCancelOrderListResponse where orders.is_empty() or orders.len() != order_reports.len(), e.g. a response decoded from a schema mismatch between adapter expectations and exchange payload.","commonSituations":"Adapter/SBE schema drift after a Binance protocol update; truncated or corrupted response; exchange bug returning reports for a subset of orders.","solutions":["Update the Binance adapter to the latest version so the SBE schema matches the exchange's current protocol","Dump the raw response bytes to verify whether orders and orderReports genuinely differ upstream","Retry the cancel; one-off inconsistencies are transient","If reproducible, file a bug with the raw payload and adapter version"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before consuming the response, sanity-check pairing yourself\nif resp.orders.is_empty() || resp.orders.len() != resp.order_reports.len() {\n    // skip/fallback rather than process\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"orders and\") => {\n        tracing::warn!(\"order list response inconsistent; falling back to open-orders query\");\n        reconcile_from_open_orders().await?;\n    },\n    other => other?,\n}","preventionTips":["Pin adapter version to a Binance SBE schema you've validated against live traffic","Keep the adapter updated when Binance bumps protocol versions","Log raw response bytes on failure for bug reports","Reconcile from openOrders endpoints when list responses look incomplete"],"tags":["binance","order-list","response-validation","schema-mismatch"],"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-14T00:17:10.932Z"}