nautechsystems/nautilus_trader · 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

Raised when the execution client polls the cache waiting for the Bybit account to appear (registered by reconciliation) and the timeout elapses without registration. connect() fails because order/fill handling requires a registered AccountId.

Source

Thrown at crates/adapters/bybit/src/execution.rs:341

        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_product_type_for_instrument(&self, instrument_id: InstrumentId) -> BybitProductType {
        BybitProductType::from_suffix(instrument_id.symbol.as_str()).unwrap_or_else(|| {
            log::warn!("No product-type suffix on {instrument_id}, defaulting to Linear");
            BybitProductType::Linear
        })
    }

    const fn provides_bulk_position_coverage_for_product_type(
        product_type: BybitProductType,
    ) -> bool {
        !matches!(product_type, BybitProductType::Spot)
    }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Increase the account-registration timeout in the client configuration
  2. Verify API key/secret are valid and the account is enabled for trading
  3. Check network connectivity to Bybit endpoints
  4. Inspect logs for reconciliation errors preceding the timeout

Example fix

// before
BybitExecClientConfig::new(...).with_timeout_secs(5.0);
// after
BybitExecClientConfig::new(...).with_timeout_secs(30.0);
Defensive patterns

Strategy: retry

Validate before calling

// before connect: verify credentials shape and timeout config
assert!(!api_key.is_empty() && !api_secret.is_empty(), "missing Bybit credentials");
assert!(timeout_secs >= 30.0, "account registration timeout too short");

Try / catch

match exec_client.connect().await {
    Err(e) if e.to_string().contains("Timeout waiting for account") => {
        // wait/backoff, verify credentials, then retry connect
        tokio::time::sleep(Duration::from_secs(5)).await;
        exec_client.connect().await?;
    }
    r => r?,
}

Prevention

When it happens

Trigger: Calling connect() when account registration does not complete within timeout_secs — cache.account(&account_id) stays None for the whole polling loop.

Common situations: Slow REST/WS connectivity to Bybit; wrong API credentials preventing account state from loading; very short configured timeout; reconciliation not producing the account in the cache.

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