{"record":{"id":"ee493775c5095eff","repo":"nautechsystems/nautilus_trader","slug":"timeout-waiting-for-account-account-id-to-be-reg-ee4937","errorCode":null,"errorMessage":"Timeout waiting for account {account_id} to be registered after {timeout_secs}s","messagePattern":"Timeout waiting for account (.+?) to be registered after (.+?)s","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/bybit/src/execution.rs","lineNumber":341,"sourceCode":"        if self.core.cache().account(&account_id).is_some() {\n            log::info!(\"Account {account_id} registered\");\n            return Ok(());\n        }\n\n        let start = Instant::now();\n        let timeout = Duration::from_secs_f64(timeout_secs);\n        let interval = Duration::from_millis(10);\n\n        loop {\n            tokio::time::sleep(interval).await;\n\n            if self.core.cache().account(&account_id).is_some() {\n                log::info!(\"Account {account_id} registered\");\n                return Ok(());\n            }\n\n            if start.elapsed() >= timeout {\n                anyhow::bail!(\n                    \"Timeout waiting for account {account_id} to be registered after {timeout_secs}s\"\n                );\n            }\n        }\n    }\n\n    fn get_product_type_for_instrument(&self, instrument_id: InstrumentId) -> BybitProductType {\n        BybitProductType::from_suffix(instrument_id.symbol.as_str()).unwrap_or_else(|| {\n            log::warn!(\"No product-type suffix on {instrument_id}, defaulting to Linear\");\n            BybitProductType::Linear\n        })\n    }\n\n    const fn provides_bulk_position_coverage_for_product_type(\n        product_type: BybitProductType,\n    ) -> bool {\n        !matches!(product_type, BybitProductType::Spot)\n    }","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bybit/src/execution.rs#L323-L359","documentation":"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.","triggerScenarios":"Calling connect() when account registration does not complete within timeout_secs — cache.account(&account_id) stays None for the whole polling loop.","commonSituations":"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.","solutions":["Increase the account-registration timeout in the client configuration","Verify API key/secret are valid and the account is enabled for trading","Check network connectivity to Bybit endpoints","Inspect logs for reconciliation errors preceding the timeout"],"exampleFix":"// before\nBybitExecClientConfig::new(...).with_timeout_secs(5.0);\n// after\nBybitExecClientConfig::new(...).with_timeout_secs(30.0);","handlingStrategy":"retry","validationCode":"// before connect: verify credentials shape and timeout config\nassert!(!api_key.is_empty() && !api_secret.is_empty(), \"missing Bybit credentials\");\nassert!(timeout_secs >= 30.0, \"account registration timeout too short\");","typeGuard":null,"tryCatchPattern":"match exec_client.connect().await {\n    Err(e) if e.to_string().contains(\"Timeout waiting for account\") => {\n        // wait/backoff, verify credentials, then retry connect\n        tokio::time::sleep(Duration::from_secs(5)).await;\n        exec_client.connect().await?;\n    }\n    r => r?,\n}","preventionTips":["Use a generous account-registration timeout (30s+) for slow links","Validate API credentials with a lightweight REST call before connecting","Monitor reconciliation logs to confirm the account is being registered"],"tags":["bybit","execution","timeout","account","connect"],"backgroundTag":"request-timeout","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}