{"record":{"id":"1ddb8a6f3bd457fe","repo":"nautechsystems/nautilus_trader","slug":"failed-to-create-http-client-e-1ddb8a","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/deribit/src/http/client.rs","lineNumber":228,"sourceCode":"            max_delay_ms: retry_delay_max_ms,\n            backoff_factor: 2.0,\n            jitter_ms: 1000,\n            operation_timeout_ms: Some(60_000),\n            immediate_first: false,\n            max_elapsed_ms: Some(180_000),\n        };\n\n        let retry_manager = RetryManager::new(retry_config);\n\n        Ok(Self {\n            base_url,\n            client: HttpClient::builder()\n                .keyed_quotas(Self::rate_limiter_quotas())\n                .default_quota(*DERIBIT_HTTP_REST_QUOTA)\n                .timeout_secs(timeout_secs)\n                .maybe_proxy_url(proxy_url)\n                .build()\n                .map_err(|e| anyhow::anyhow!(\"Failed to create HTTP client: {e}\"))?,\n            credential: None,\n            retry_manager,\n            cancellation_token: CancellationToken::new(),\n            request_id: AtomicU64::new(1),\n        })\n    }\n\n    /// Get the cancellation token for this client.\n    pub fn cancellation_token(&self) -> &CancellationToken {\n        &self.cancellation_token\n    }\n\n    /// Returns whether this client is connected to testnet.\n    #[must_use]\n    pub fn is_testnet(&self) -> bool {\n        self.base_url.contains(\"test.\")\n    }\n","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/deribit/src/http/client.rs#L210-L246","documentation":"Raised by the unauthenticated DeribitHttpClient constructor when HttpClient::builder()...build() fails. The builder error is wrapped via anyhow with the message 'Failed to create HTTP client: {e}'. This happens before any network traffic, i.e. the client could not even be constructed from its settings.","triggerScenarios":"DeribitHttpClient::new(...) / with_proxy(...) when builder options are invalid: bad proxy_url format, invalid timeout_secs (e.g. zero or non-positive), or conflicting rate-limiter quota configuration in rate_limiter_quotas().","commonSituations":"Passing a malformed DERIBIT proxy URL from an environment variable; constructing the client with timeout_secs=0; a library version change that made previously-tolerated builder values invalid.","solutions":["Read the inner builder error after the colon — it names the invalid setting; correct that specific value.","Validate the proxy URL is a well-formed http(s)://host:port string before constructing the client (or pass None).","Ensure timeout_secs is a positive integer and reconsider any custom quota configuration from rate_limiter_quotas()."],"exampleFix":"// before\nlet client = DeribitHttpClient::new(timeout_secs=0, proxy_url=Some(\"localhost:9222\".into()))?;\n// after\nlet client = DeribitHttpClient::new(timeout_secs=30, proxy_url=Some(\"http://localhost:9222\".into()))?;","handlingStrategy":"validation","validationCode":"fn validate_http_client_inputs(timeout_secs: u64, proxy_url: &Option<String>) -> Result<(), String> {\n    if timeout_secs == 0 { return Err(\"timeout_secs must be > 0\".into()); }\n    if let Some(url) = proxy_url {\n        url::Url::parse(url).map_err(|e| format!(\"invalid proxy url: {e}\"))?;\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"let client = DeribitHttpClient::new(timeout_secs, proxy_url)\n    .with_context(|| format!(\"constructing Deribit HTTP client (timeout={timeout_secs}, proxy={proxy_url:?})\"))?;","preventionTips":["Parse and validate proxy URLs at config-load time, before client construction.","Keep timeout values as constants or validated config fields, never ad-hoc literals like 0.","When upgrading the adapter, read the changelog for stricter HTTP client builder validation."],"tags":["rust","http","builder","deribit","configuration"],"backgroundTag":"invalid-config-value","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"}