{"record":{"id":"f7094b30fe7cd458","repo":"nautechsystems/nautilus_trader","slug":"cannot-submit-order-execution-client-not-connecte","errorCode":null,"errorMessage":"Cannot submit order: execution client not connected","messagePattern":"Cannot submit order: execution client not connected","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/dydx/src/execution/mod.rs","lineNumber":1279,"sourceCode":"        if self.core.is_stopped() {\n            log::warn!(\"dYdX execution client not started\");\n            return Ok(());\n        }\n\n        log::info!(\"Stopping dYdX execution client\");\n        self.session_tasks.begin_shutdown();\n        self.begin_pending_shutdown();\n        self.ws_client.begin_shutdown();\n        self.core.set_stopped();\n        self.core.set_disconnected();\n        Ok(())\n    }\n\n    fn submit_order(&self, cmd: SubmitOrder) -> anyhow::Result<()> {\n        if !self.is_connected() {\n            let reason = \"Cannot submit order: execution client not connected\";\n            log::error!(\"{reason}\");\n            anyhow::bail!(reason);\n        }\n\n        let current_block = self.block_time_monitor.current_block_height();\n        let order = self.core.cache().try_order_owned(&cmd.client_order_id)?;\n\n        let client_order_id = order.client_order_id();\n        let instrument_id = order.instrument_id();\n        let strategy_id = order.strategy_id();\n\n        if current_block == 0 {\n            let reason = \"Block height not initialized\";\n            log::warn!(\"Cannot submit order {client_order_id}: {reason}\");\n            self.emitter.emit_order_denied(&order, reason);\n            return Ok(());\n        }\n\n        if order.is_closed() {\n            log::warn!(\"Cannot submit closed order {client_order_id}\");","sourceCodeStart":1261,"sourceCodeEnd":1297,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/dydx/src/execution/mod.rs#L1261-L1297","documentation":"`submit_order` refuses to submit an order when the dYdX execution client's connection check (`is_connected()`) fails. This is a deliberate guard so orders are never sent over a dead WebSocket/gRPC link where they would be silently lost.","triggerScenarios":"Calling `submit_order` (directly or via `submit_order_list`) while the client is disconnected — e.g. before `connect()` completes, after a dropped WebSocket, or during a reconnect window.","commonSituations":"Strategy starts before the adapter finishes connecting; network outage drops the live connection; adapter was never started in a live/trading context.","solutions":["Wait for the client to report connected before submitting (subscribe to connection state / retry after connect)","Check network connectivity and dYdX endpoint status","Restart the adapter/node to re-establish the connection","Verify the adapter is running in live mode — a disconnected execution client will never accept orders"],"exampleFix":"// before\nclient.submit_order(cmd)?;\n// after\nif client.is_connected() {\n    client.submit_order(cmd)?;\n} else {\n    log::warn!(\"skipping submit, client disconnected\");\n}","handlingStrategy":"validation","validationCode":"if !client.is_connected() { return Err(anyhow!(\"client not connected\")); }","typeGuard":null,"tryCatchPattern":"match client.submit_order(cmd) {\n    Err(e) if e.to_string().contains(\"not connected\") => reconnect_and_retry(),\n    Err(e) => return Err(e),\n    Ok(_) => {}\n}","preventionTips":["Gate order submission on a connected-state flag/event","Subscribe to adapter connection state changes","Add a readiness wait after client startup before trading"],"tags":["dydx","connectivity","order-submission"],"backgroundTag":"connection-refused","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}