nautechsystems/nautilus_trader · error

exec-connect timeout

Error message

exec-connect timeout

What it means

connect_exec_clients wraps self.kernel.connect_exec_clients() in a timeout against the shared connection deadline. If execution clients do not all connect before the deadline, this error is returned and start() aborts with "Execution client connection timed out". It means the trading venue's execution session never established in the allowed window.

Source

Thrown at crates/live/src/node/mod.rs:2107

    }

    async fn connect_data_phase(&mut self, deadline: dst::time::Instant) -> anyhow::Result<()> {
        // A zero remaining budget still admits an immediately-ready connect (an
        // empty/ready client set completes on the first poll); a pending connect
        // fails closed on that same poll. This keeps a zero `timeout_connection`
        // - a supported "do not wait, but allow ready work" configuration -
        // working, while still bounding a hung connect.
        let remaining = deadline.saturating_duration_since(dst::time::Instant::now());
        dst::time::timeout(remaining, self.kernel.connect_data_clients())
            .await
            .map_err(|_| anyhow::anyhow!("data-connect timeout"))
    }

    async fn connect_exec_clients(&mut self, deadline: dst::time::Instant) -> anyhow::Result<()> {
        let remaining = deadline.saturating_duration_since(dst::time::Instant::now());
        dst::time::timeout(remaining, self.kernel.connect_exec_clients())
            .await
            .map_err(|_| anyhow::anyhow!("exec-connect timeout"))
    }

    /// Connects execution clients and checks all engines are connected.
    ///
    /// Returns the final connection wait status.
    /// Must be called after data clients are connected and instrument events drained.
    async fn connect_exec_phase(
        &mut self,
        deadline: dst::time::Instant,
    ) -> anyhow::Result<EngineConnectionStatus> {
        self.connect_exec_clients(deadline).await?;
        Ok(self.await_engines_connected(deadline).await)
    }

    fn startup_abort_reason(&self) -> Option<&'static str> {
        if self.handle.should_stop() {
            Some("Stop signal received during startup")
        } else if self.kernel.is_shutdown_requested() {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Increase timeout_connection so both data and exec connects fit within the shared deadline.
  2. Verify execution venue credentials and that the venue is not in maintenance; check adapter logs for auth errors.
  3. Confirm the execution WebSocket/REST endpoints are reachable from the host.
  4. If a specific exec adapter consistently hangs, update or replace the adapter / fix its endpoint configuration.

Example fix

// before
timeout_connection: Duration::from_secs(20)
// after
timeout_connection: Duration::from_secs(90)
Defensive patterns

Strategy: retry

Validate before calling

// Confirm exec credentials and venue availability before start
assert!(!api_key.is_empty() && !api_secret.is_empty());
TcpStream::connect((exec_ws_host, port)).expect("exec websocket unreachable");

Try / catch

match node.start().await {
    Err(e) if e.to_string().contains("exec-connect timeout") => {
        // check venue status / credentials, raise timeout_connection, retry
    }
    other => other?,
}

Prevention

When it happens

Trigger: dst::time::timeout(remaining, connect_exec_clients()) elapses in connect_exec_clients (mod.rs:2103-2108); called from start() and connect_exec_phase after data clients are connected.

Common situations: Exchange maintenance windows rejecting logins; wrong API keys causing hanging auth; slow venue WebSocket handshake; data connect consumed most of timeout_connection leaving little budget for exec connect.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


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