nautechsystems/nautilus_trader · error · anyhow::Error

Timeout waiting for account {account_id} to be registered af

Error message

Timeout waiting for account {account_id} to be registered after {timeout_secs}s

What it means

After connecting, the dYdX execution client polls the cache until the exchange account (identified by account_id) has been registered, waiting at most timeout_secs. If the account never appears within the timeout it bails, indicating the account-registration flow did not complete.

Source

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

        if self.core.cache().account(&account_id).is_some() {
            log::info!("Account {account_id} registered");
            return Ok(());
        }

        let start = Instant::now();
        let timeout = Duration::from_secs_f64(timeout_secs);
        let interval = Duration::from_millis(10);

        loop {
            tokio::time::sleep(interval).await;

            if self.core.cache().account(&account_id).is_some() {
                log::info!("Account {account_id} registered");
                return Ok(());
            }

            if start.elapsed() >= timeout {
                anyhow::bail!(
                    "Timeout waiting for account {account_id} to be registered after {timeout_secs}s"
                );
            }
        }
    }
}

/// Broadcasts cancel orders with optimal partitioned strategy.
///
/// Partitions orders into short-term and long-term/conditional groups:
/// - Short-term -> single `MsgBatchCancel` via `broadcast_short_term()`
/// - Long-term/conditional -> batched `MsgCancelOrder` via `broadcast_with_retry()`
///
/// At most 2 gRPC calls regardless of order count or mix.
async fn broadcast_partitioned_cancels(
    orders: Vec<DydxCancelOrderRequest>,
    block_height: u32,
    tx_manager: Arc<TransactionManager>,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Increase the registration timeout to accommodate slow networks
  2. Verify credentials and that the account_id matches the connected dYdX wallet
  3. Check logs for earlier WebSocket/subscription errors preventing registration
  4. Test exchange connectivity and retry connect()

Example fix

// before
let client = DydxExecutionClient::new(config_with_timeout_secs(5), ...);
// after
let client = DydxExecutionClient::new(config_with_timeout_secs(30), ...);
Defensive patterns

Strategy: try-catch

Validate before calling

// before connecting, verify credentials/config
let account_id = AccountId::new(&format!("DYDX-{wallet_address}"));
assert!(!wallet_address.is_empty(), "wallet address must be configured");

Try / catch

match client.connect().await {
    Ok(()) => {},
    Err(e) if e.to_string().contains("Timeout waiting for account") => {
        // check network/credentials, increase timeout, retry once
        log::error!("account registration timed out: {e}");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling connect() when the account never gets registered in the cache within the configured timeout — e.g. the dYdX account registration subscription never delivers data or registration fails silently.

Common situations: Network latency or a stalled WebSocket preventing registration messages from arriving; wrong account/instrument configuration so the expected account id never appears; exchange outage or auth failure upstream.

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/d0b64f371b1859e8. Report an issue: GitHub.