nautechsystems/nautilus_trader · error · anyhow::Error
WS modify order failed
Error message
WS modify order failed: {e} What it means
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.
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
Example fix
// before
exec_client.modify_order(instrument_id, client_order_id, Some(new_qty))
// after
match exec_client.modify_order(instrument_id, client_order_id, Some(new_qty)) {
Ok(_) => {},
Err(e) => { exec_client.cancel_order(instrument_id, client_order_id); /* re-submit */ }
} Defensive patterns
Strategy: try-catch
Validate before calling
// precheck: only amend live orders with valid tick/lot-conformant values assert!(is_open_order(client_order_id)); assert!(price % tick_size == 0 && qty % lot_size == 0);
Try / catch
match client.modify_order(...) { Ok(_) => {}, Err(e) => { log::error!("WS modify failed: {e}"); reconcile_order_state(client_order_id); } } Prevention
- Check order status before amending
- Clamp amend values to tick/lot size
- Prefer cancel-and-replace for race-prone amends
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Binance Spot data teardown failed
- Cancel algo order failed: code=
- Cancel all algo orders failed
- Cancel all orders failed
- Failed to send message
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/996891e3b85e4991.
Report an issue: GitHub.
Appendix: source
Thrown at crates/adapters/binance/src/futures/execution.rs:3389
request_id.clone(),
PendingRequest {
client_order_id: command.client_order_id,
venue_order_id,
operation: PendingOperation::Modify,
},
);
self.spawn_task("modify_order_ws", async move {
if let Err(e) = ws_client
.modify_order_with_id(request_id.clone(), params)
.await
{
dispatch_state.pending_requests.remove(&request_id);
log::error!(
"WS modify request failed for {}: {e}",
command.client_order_id
);
anyhow::bail!("WS modify order failed: {e}");
}
Ok(())
});
return Ok(());
}
self.spawn_task("modify_order", async move {
let result = http_client
.modify_order(
account_id,
instrument_id,
venue_order_id,
client_order_id,
order_side,
quantity,
price,
)View on GitHub (pinned to 18893faf8b)