{"record":{"id":"996891e3b85e4991","repo":"nautechsystems/nautilus_trader","slug":"ws-modify-order-failed-e","errorCode":null,"errorMessage":"WS modify order failed: {e}","messagePattern":"WS modify order failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/execution.rs","lineNumber":2872,"sourceCode":"                request_id.clone(),\n                PendingRequest {\n                    client_order_id: command.client_order_id,\n                    venue_order_id,\n                    operation: PendingOperation::Modify,\n                },\n            );\n\n            self.spawn_task(\"modify_order_ws\", async move {\n                if let Err(e) = ws_client\n                    .modify_order_with_id(request_id.clone(), params)\n                    .await\n                {\n                    dispatch_state.pending_requests.remove(&request_id);\n                    log::error!(\n                        \"WS modify request failed for {}: {e}\",\n                        command.client_order_id\n                    );\n                    anyhow::bail!(\"WS modify order failed: {e}\");\n                }\n                Ok(())\n            });\n\n            return Ok(());\n        }\n\n        self.spawn_task(\"modify_order\", async move {\n            let result = http_client\n                .modify_order(\n                    account_id,\n                    instrument_id,\n                    venue_order_id,\n                    client_order_id,\n                    order_side,\n                    quantity,\n                    price,\n                )","sourceCodeStart":2854,"sourceCodeEnd":2890,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/futures/execution.rs#L2854-L2890","documentation":"When WebSocket order entry is active (config use_ws_trading with USD-M futures), modify requests are sent over the trading socket via modify_order_with_id. If that request fails — socket not yet connected, dropped mid-flight, timeout awaiting the response, or an error returned by the WS API — the adapter removes the pending-request entry, logs the failure, and raises this error from the spawned task. The order itself is left unmodified pending reconciliation.","triggerScenarios":"ModifyOrder while ws trading is enabled and modify_order_with_id errors: connection not established yet, disconnect/reconnect window, response timeout, or a WS API rejection of the modify payload.","commonSituations":"Unstable networks; modifies issued immediately after startup before the WS session is ready; Binance WS maintenance windows; rate limiting on the order-entry connection.","solutions":["Retry the modify once the WS connection is healthy — verify via connection logs/status","Set use_ws_trading=false in BinanceExecClientConfig to route modifies over REST HTTP instead","Query the order state first (QueryOrder) to confirm it is still open before re-modifying","If persistent, inspect the underlying {e} and check Binance futures WS API status"],"exampleFix":"// before — WebSocket order entry enabled (default)\nlet config = BinanceExecClientConfigBuilder::default()\n    .use_ws_trading(true)\n    .build()?;\n\n// after — route modify/cancel over REST\nlet config = BinanceExecClientConfigBuilder::default()\n    .use_ws_trading(false)\n    .build()?;","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"Handle the error where modify results surface: verify current order state with QueryOrder, then either retry after the trading socket reconnects or resubmit the modify over REST (set use_ws_trading=false).","preventionTips":["Wait for WS trading connection establishment before sending modifications","Set use_ws_trading=false in BinanceExecClientConfig on unstable networks to use REST order entry","Monitor pending-request cleanup and reconnect logs on the trading socket"],"tags":["binance","futures","websocket","order-modify","rust"],"backgroundTag":"websocket-request-failed","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}