{"record":{"id":"acc380d8baf8e18e","repo":"nautechsystems/nautilus_trader","slug":"ws-cancel-order-failed-e-acc380","errorCode":null,"errorMessage":"WS cancel order failed: {e}","messagePattern":"WS cancel order failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/execution.rs","lineNumber":510,"sourceCode":"                request_id.clone(),\n                PendingRequest {\n                    client_order_id: command.client_order_id,\n                    venue_order_id: command.venue_order_id,\n                    operation: PendingOperation::Cancel,\n                },\n            );\n\n            self.spawn_task(\"cancel_order_ws\", async move {\n                if let Err(e) = ws_client\n                    .cancel_order_with_id(request_id.clone(), params)\n                    .await\n                {\n                    dispatch_state.pending_requests.remove(&request_id);\n                    log::warn!(\n                        \"WS cancel request failed for {}, awaiting reconciliation: {e}\",\n                        command.client_order_id\n                    );\n                    anyhow::bail!(\"WS cancel order failed: {e}\");\n                }\n                Ok(())\n            });\n        } else {\n            let http_client = self.http_client.clone();\n            let dispatch_state = self.dispatch_state.clone();\n            log::debug!(\"WS trading not active, falling back to HTTP for cancel_order\");\n\n            self.spawn_task(\"cancel_order_http\", async move {\n                let result = http_client\n                    .cancel_order(\n                        command.instrument_id,\n                        command.venue_order_id,\n                        Some(command.client_order_id),\n                    )\n                    .await;\n\n                match result {","sourceCodeStart":492,"sourceCodeEnd":528,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/spot/execution.rs#L492-L528","documentation":"Thrown when cancelling a Binance Spot order over the WebSocket API fails. Like the submit path, the pending request is removed and a warning is logged noting the cancel result will be resolved by reconciliation, then the error propagates to `cancel_order`.","triggerScenarios":"`cancel_order_internal` sends a cancel-order WS API request and the response/await fails — Binance rejects the cancel (unknown order, already filled, wrong orig_client_order_id), signature/auth error, or the WS connection failed before a response arrived.","commonSituations":"Cancelling an order that was already filled or expired; using a client_order_id that Binance does not recognize; network drop while the cancel request is in flight; strategy cancelling stale orders after a reconnect.","solutions":["Read the logged inner error for the Binance reject reason (e.g. -2011 Unknown order sent) and verify the client_order_id/order state","Rely on reconciliation/order status events to learn the order's final state rather than immediately re-cancelling","Check connectivity to the WS API endpoint and credentials","Retry the cancel only after confirming the order is still open"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if let Err(e) = client.cancel_order(&command).await {\n    log::warn!(\"cancel failed: {e}; order state will arrive via reconciliation\");\n}","preventionTips":["Track order state locally and only cancel orders known to be open","Use the same client_order_id that was used at submit","Treat -2011 (unknown order) as 'already closed' rather than a hard failure"],"tags":["binance","spot","websocket","cancel-order","network"],"backgroundTag":"api-request-failed","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}