{"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":3389,"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":3371,"sourceCodeEnd":3407,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/futures/execution.rs#L3371-L3407","documentation":"Raised when a WebSocket (order Amend/Modify) request to Binance Futures is rejected by the exchange. The request id is removed from pending_requests and the error is propagated to the caller of the modify-order command handler with the underlying exchange message.","triggerScenarios":"Submitting a WS order modify (e.g. amend_price / amend_quantity) whose response carries an error code — invalid order ID, order already filled or canceled, price/qty violations, or duplicate modify in flight.","commonSituations":"Race with the order being filled before the amend arrives; modifying an order whose client_order_id the exchange no longer knows; amend values below tick/lot constraints.","solutions":["Read the wrapped exchange message {e} for the Binance error code and fix the specific violation","Verify the order still exists and is open (check order status) before modifying","Ensure amend values conform to tick size and lot size for the symbol","Fall back to cancel-and-replace if amends are repeatedly rejected","Check clock sync/API permissions if the error is auth- or timestamp-related"],"exampleFix":"// before\nexec_client.modify_order(instrument_id, client_order_id, Some(new_qty))\n// after\nmatch exec_client.modify_order(instrument_id, client_order_id, Some(new_qty)) {\n    Ok(_) => {},\n    Err(e) => { exec_client.cancel_order(instrument_id, client_order_id); /* re-submit */ }\n}","handlingStrategy":"try-catch","validationCode":"// precheck: only amend live orders with valid tick/lot-conformant values\nassert!(is_open_order(client_order_id));\nassert!(price % tick_size == 0 && qty % lot_size == 0);","typeGuard":null,"tryCatchPattern":"match client.modify_order(...) { Ok(_) => {}, Err(e) => { log::error!(\"WS modify failed: {e}\"); reconcile_order_state(client_order_id); } }","preventionTips":["Check order status before amending","Clamp amend values to tick/lot size","Prefer cancel-and-replace for race-prone amends"],"tags":["rust","binance","websocket","order-modify","exchange-rejection"],"backgroundTag":"api-error-response","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"}