{"record":{"id":"840350edf2a3ef1b","repo":"nautechsystems/nautilus_trader","slug":"ws-submit-order-failed-e","errorCode":null,"errorMessage":"WS submit order failed: {e}","messagePattern":"WS submit order failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"critical","filePath":"crates/adapters/binance/src/futures/execution.rs","lineNumber":667,"sourceCode":"            // Pre-register before sending to avoid response racing the insert\n            let request_id = ws_client.next_request_id();\n            dispatch_state.pending_requests.insert(\n                request_id.clone(),\n                PendingRequest {\n                    client_order_id,\n                    venue_order_id: None,\n                    operation: PendingOperation::Place,\n                },\n            );\n\n            self.spawn_task(\"submit_order_ws\", async move {\n                if let Err(e) = ws_client\n                    .place_order_with_id(request_id.clone(), params)\n                    .await\n                {\n                    dispatch_state.pending_requests.remove(&request_id);\n                    log::error!(\"WS submit request failed for {client_order_id}: {e}\");\n                    anyhow::bail!(\"WS submit order failed: {e}\");\n                }\n                Ok(())\n            });\n\n            return Ok(());\n        }\n\n        let http_client = self.http_client.clone();\n\n        self.spawn_task(\"submit_order\", async move {\n            let result = if use_algo_api {\n                http_client\n                    .submit_algo_order(\n                        account_id,\n                        instrument_id,\n                        client_order_id,\n                        order_side,\n                        order_type,","sourceCodeStart":649,"sourceCodeEnd":685,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/futures/execution.rs#L649-L685","documentation":"Raised inside the spawned submit_order_ws task when the Binance WebSocket API place_order_with_id call fails for an order routed to WS submission. The client removes the order's entry from pending_requests, logs 'WS submit request failed for {client_order_id}', and bails with this message carrying the underlying WS error. submit_order itself already returned Ok, so the failure surfaces asynchronously through the task/log and order-event flow rather than as a synchronous error.","triggerScenarios":"Submitting over the Binance futures WS order channel an order that violates exchange filters (PRICE_FILTER, LOT_SIZE, MIN_NOTIONAL), exceeds available margin, hits the order rate limit, or is sent while the WS connection is closed or reconnecting.","commonSituations":"High-frequency strategies exceeding max_order_submit_rate; prices/quantities rounded to strategy-side precision instead of the instrument's precision; WS session dropped during volatility and submissions continuing on the stale connection.","solutions":["Read the embedded WS error code in the logged {e} (filter names like PERCENT_PRICE_BY_SIDE or -2019 insufficient margin) and correct the offending field","Round price and quantity to the instrument's price/size precision from the cached instrument definitions","Throttle submissions to the venue's order rate limits (max_order_submit_rate config)","If WS errors persist, verify connection health or route submissions over HTTP if the client configuration allows it"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"use nautilus_model::types::fixed::FixedPrecision; // conceptual\n// Pre-submit against cached instrument filters:\nlet f = instrument_filters(instrument_id);\nanyhow::ensure!(qty >= f.min_qty && price >= f.min_price && (price * qty) >= f.min_notional);\nanyhow::ensure!(price % f.tick_size == 0 && qty % f.step_size == 0);","typeGuard":null,"tryCatchPattern":"// submit_order returns Ok; the WS failure is async. Handle it via order events:\n// match OrderEvent for this client_order_id —\n//   OrderDenied/OrderRejected => read the logged 'WS submit request failed' error,\n//   correct fields (precision, notional, margin) or back off, then resubmit once.\n// never blind-retry on filter rejections (-4xxx / -2021 family)","preventionTips":["Round price/size to instrument precision before submitting","Respect max_order_submit_rate and the venue's order rate limits","Watch WS connection state and pause submissions during reconnects","Log and alert on every 'WS submit request failed' line; it means no order reached the venue"],"tags":["binance-futures","order-entry","websocket","execution","rust"],"backgroundTag":"order-submission-failed","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}