nautechsystems/nautilus_trader · error · anyhow::Error

Cannot submit order list: execution client not connected

Error message

Cannot submit order list: execution client not connected

What it means

`submit_order_list` rejects the entire order list up front if the execution client is not connected. It mirrors the `submit_order` gate and fires before any TIF validation, block-height checks, or TX building so strategies get an immediate denial.

Source

Thrown at crates/adapters/dydx/src/execution/mod.rs:1580

                        .await?;
                }
                log::debug!("Successfully submitted {order_type_str} order: {client_order_id}");

                Ok(())
            },
        );

        Ok(())
    }

    fn submit_order_list(&self, cmd: SubmitOrderList) -> anyhow::Result<()> {
        let orders = self.core.get_orders_for_list(&cmd.order_list)?;
        let order_count = orders.len();

        if !self.is_connected() {
            let reason = "Cannot submit order list: execution client not connected";
            log::error!("{reason}");
            anyhow::bail!(reason);
        }

        // Pre-submission TIF gate: deny FOK and DAY before doing any further
        // work, mirroring `submit_order`'s gate. Done up front so the strategy
        // sees an immediate `OrderDenied` even when the rest of the pipeline
        // (block height, TX manager) is not yet ready.
        let unsupported_tif_reason = |order: &OrderAny| match order.time_in_force() {
            TimeInForce::Fok => Some(
                "Fill-or-kill (FOK) orders are deprecated by dYdX v4 (chain rejects with code=48)",
            ),
            TimeInForce::Day => Some("DAY time-in-force is not supported by dYdX v4"),
            _ => None,
        };

        if orders
            .iter()
            .any(|order| unsupported_tif_reason(order).is_some())
        {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Ensure the client is connected before issuing an order list (await connection event)
  2. Check network and dYdX endpoint availability
  3. Reconnect or restart the adapter, then resubmit the list

Example fix

// before
client.submit_order_list(list_cmd)?;
// after
if !client.is_connected() {
    client.connect().await?;
}
client.submit_order_list(list_cmd)?;
Defensive patterns

Strategy: validation

Validate before calling

if !client.is_connected() { return Err(anyhow!("client not connected")); }

Try / catch

if let Err(e) = client.submit_order_list(cmd) {
    if e.to_string().contains("not connected") { client.connect().await?; /* resubmit */ }
}

Prevention

When it happens

Trigger: Calling `submit_order_list` while `is_connected()` returns false — before connection is established, after a disconnect, or during reconnection.

Common situations: Bulk order submission at strategy startup before the adapter link is live; network interruption between connect and submit; failover windows.

Understand the failure class

Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/8b66609f0b60563f. Report an issue: GitHub.