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 execution client waits (polling in a loop) until the account created from the venue data has been registered in the core cache. If the account does not appear within the configured timeout (timeout_secs), the connect routine fails with this error.

Source

Thrown at crates/adapters/hyperliquid/src/execution.rs:505

        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"
                );
            }
        }
    }

    fn get_account_address(&self) -> anyhow::Result<String> {
        self.http_client
            .get_account_address()
            .context("failed to get account address from HTTP client")
    }

    fn spawn_task<F>(&self, description: &'static str, fut: F)
    where
        F: std::future::Future<Output = anyhow::Result<()>> + Send + 'static,
    {
        let future = async move {
            if let Err(e) = fut.await {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Increase the connect timeout (timeout_secs) to accommodate network latency.
  2. Check the logs just before this error for errors loading the account from Hyperliquid (auth failures, HTTP errors) — fix the root cause.
  3. Verify API wallet credentials/address are correct so the account state can be loaded.
  4. Check network/proxy connectivity to the Hyperliquid API and retry connect.

Example fix

// before
let client = HyperliquidExecutionClient::new(..., /* timeout_secs */ 5)?;
client.connect().await?;
// after
// give slow networks more time for initial account registration
let client = HyperliquidExecutionClient::new(..., /* timeout_secs */ 30)?;
client.connect().await?;
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure credentials and venue address are configured before connect
assert!(config.api_wallet_address.is_some(), "Hyperliquid credentials required");

Try / catch

match client.connect().await {
    Ok(()) => {},
    Err(e) if e.to_string().contains("Timeout waiting for account") => {
        log::warn!("account registration slow; retrying with larger timeout");
        // reconnect with increased timeout
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling connect on the Hyperliquid execution client when the account/entity initialisation from the venue response is slow, delayed, or never completes — cache().account(&account_id) keeps returning None until start.elapsed() exceeds the timeout.

Common situations: Slow or degraded Hyperliquid API connectivity delaying initial account state loading; misconfigured credentials causing the account to never be provisioned; very short timeout configured for a high-latency network; venue returning an empty/invalid account state.

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