{"record":{"id":"cda74a5844a0ea82","repo":"nautechsystems/nautilus_trader","slug":"order-list-was-not-fully-canceled-status","errorCode":null,"errorMessage":"order list {} was not fully canceled: status={:?}, order_status={:?}","messagePattern":"order list (.+?) was not fully canceled: status=(.+?), order_status=(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/execution.rs","lineNumber":2538,"sourceCode":"                )?;\n            }\n        }\n    }\n\n    Ok(prepared)\n}\n\nfn 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!(","sourceCodeStart":2520,"sourceCodeEnd":2556,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/spot/execution.rs#L2520-L2556","documentation":"The cancel order-list response indicates the list was not fully canceled: listStatusType or listOrderStatus is not AllDone. prepare_cancel_order_list requires the exchange to confirm the whole list reached DONE before emitting cancels, otherwise some orders may remain live while local state says canceled.","triggerScenarios":"cancel_all_orders triggers a cancel order list where the exchange responds with status e.g. DONE vs ALL_DONE variants such as EXEC_STARTED or REJECT, or list_order_status != AllDone because an order in the list already filled or could not be canceled.","commonSituations":"OCO lists partially filled before the cancel arrived; cancel raced with execution; exchange rejected part of the list cancel due to price/quantity constraints.","solutions":["Check the reported status/list_order_status to see which stage failed","Query open orders for the symbol to find remaining live orders and cancel them individually","Retry the cancel for orders that remain open","Handle partial fills: reconcile fills via the trade stream instead of assuming cancellation"],"exampleFix":"// before\n// assume cancel-all succeeded\n// after\n// check status before proceeding, re-query open orders and cancel leftovers individually","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match cancel_all_orders(instrument_id).await {\n    Err(e) if e.to_string().contains(\"not fully canceled\") => {\n        // re-query open orders and cancel leftovers individually\n        let open = query_open_orders(instrument_id).await?;\n        for o in open { cancel_order(o.client_order_id).await?; }\n    },\n    Err(e) => return Err(e),\n    Ok(_) => {},\n}","preventionTips":["Avoid canceling OCO lists during volatile periods when fills race with cancels","Always reconcile open orders after cancel-all instead of assuming success","Handle trade/fill events concurrently so partial fills don't invalidate cancel state","Check listStatusType/listOrderStatus semantics in Binance docs before interpreting AllDone"],"tags":["binance","order-list","cancel-orders","partial-cancel"],"backgroundTag":"invalid-state-transition","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"}