{"record":{"id":"6b0514c1bfd4da0f","repo":"nautechsystems/nautilus_trader","slug":"failed-to-create-http-client-e-6b0514","errorCode":null,"errorMessage":"Failed to create HTTP client: {e}","messagePattern":"Failed to create HTTP client: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/betfair/src/http/client.rs","lineNumber":130,"sourceCode":"            jitter_ms: 500,\n            operation_timeout_ms: Some(30_000),\n            immediate_first: false,\n            max_elapsed_ms: Some(120_000),\n        };\n\n        Ok(Self {\n            client: HttpClient::new(\n                HashMap::new(),\n                Vec::new(),\n                Self::rate_limiter_quotas(\n                    request_rate_per_second.unwrap_or(5),\n                    order_request_rate_per_second.unwrap_or(20),\n                )?,\n                Self::default_quota(request_rate_per_second.unwrap_or(5))?,\n                timeout_secs,\n                proxy_url,\n            )\n            .map_err(|e| anyhow::anyhow!(\"Failed to create HTTP client: {e}\"))?,\n            credential,\n            session_token: Arc::new(tokio::sync::RwLock::new(None)),\n            retry_manager: RetryManager::new(retry_config),\n            cancellation_token: std::sync::Mutex::new(CancellationToken::new()),\n            connect_lock: tokio::sync::Mutex::new(()),\n            request_id: AtomicU64::new(1),\n            url_identity_login: BETFAIR_IDENTITY_LOGIN_URL.to_string(),\n            url_keep_alive: BETFAIR_KEEP_ALIVE_URL.to_string(),\n            url_betting: BETFAIR_BETTING_URL.to_string(),\n            url_accounts: BETFAIR_ACCOUNTS_URL.to_string(),\n            url_navigation: BETFAIR_NAVIGATION_URL.to_string(),\n        })\n    }\n\n    /// Overrides the API base URLs (for testing with mock servers).\n    ///\n    /// The keep-alive URL is derived from `identity_login` by replacing the\n    /// path with `/keepAlive`.","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/betfair/src/http/client.rs#L112-L148","documentation":"BetfairHttpClient::new could not build the underlying rate-limited HttpClient. The dominant cause is quota construction: make_quota requires request_rate_per_second and order_request_rate_per_second to be non-zero (NonZeroU32), so a configured 0 fails with 'must be greater than zero'. Other transport-construction failures (e.g. an unusable proxy_url) surface through the same wrapped message.","triggerScenarios":"Creating the Betfair data or execution client with request_rate_per_second: Some(0) or order_request_rate_per_second: Some(0) in the config; or a malformed proxy_url reaching HttpClient::new.","commonSituations":"Setting rates to 0 intending 'unlimited'; config typos or defaults producing 0; explicitly disabling order rate limiting.","solutions":["Set both rate options to positive values (defaults are 5 and 20 requests/sec) or leave them unset to use the defaults.","Validate config values in BetfairDataConfig/BetfairExecConfig::validate before client creation.","Remove or fix proxy_url if provided."],"exampleFix":"// before\nlet config = BetfairExecConfig {\n    request_rate_per_second: Some(0), // 'unlimited' -> rejected\n    order_request_rate_per_second: Some(0),\n    ..Default::default()\n};\n\n// after\nlet config = BetfairExecConfig {\n    request_rate_per_second: Some(5),\n    order_request_rate_per_second: Some(20),\n    ..Default::default()\n};","handlingStrategy":"validation","validationCode":"fn rates_valid(request_rate: Option<u32>, order_rate: Option<u32>) -> bool {\n    request_rate.unwrap_or(5) > 0 && order_rate.unwrap_or(20) > 0\n}\n\nif !rates_valid(config.request_rate_per_second, config.order_request_rate_per_second) {\n    return Err(anyhow::anyhow!(\"rate limits must be > 0\"));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never set request rates to 0 — use positive values or leave unset for defaults (5/20 per second).","Validate numeric config fields in validate() before client creation.","Test client creation in CI with production-like config values."],"tags":["betfair","http-client","rate-limit","config","startup"],"backgroundTag":"invalid-config-value","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}