{"record":{"id":"fe21b61b6abc2752","repo":"nautechsystems/nautilus_trader","slug":"failed-to-create-http-client-e-fe21b6","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/coinbase/src/data/mod.rs","lineNumber":142,"sourceCode":"            .proxy_url\n            .as_ref()\n            .map(|value| value.expose_secret().to_owned());\n\n        let http_client = match CoinbaseCredential::resolve(\n            config.api_key.as_ref().map(|value| value.expose_secret()),\n            config\n                .api_secret\n                .as_ref()\n                .map(|value| value.expose_secret()),\n        ) {\n            Some(credential) => CoinbaseHttpClient::with_credentials(\n                credential,\n                config.environment,\n                config.http_timeout_secs,\n                proxy_url.clone(),\n                Some(retry_config),\n            )\n            .map_err(|e| anyhow::anyhow!(\"Failed to create HTTP client: {e}\"))?,\n            None => CoinbaseHttpClient::new(\n                config.environment,\n                config.http_timeout_secs,\n                proxy_url.clone(),\n                Some(retry_config),\n            )\n            .map_err(|e| anyhow::anyhow!(\"Failed to create HTTP client: {e}\"))?,\n        };\n\n        if let Some(url) = &config.base_url_rest {\n            http_client.set_base_url(url.clone());\n        }\n\n        let ws_url = config.ws_url();\n        let ws_client = CoinbaseWebSocketClient::new(&ws_url, config.transport_backend, proxy_url)\n            .with_socket_control(SocketControl::new(\n                client_id,\n                Some(*COINBASE_VENUE),","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/coinbase/src/data/mod.rs#L124-L160","documentation":"The Coinbase data client's `new` constructor failed to build the authenticated CoinbaseHttpClient (used for REST polling). The underlying error from the HTTP client builder is wrapped with anyhow and rethrown as a single error carrying the original message.","triggerScenarios":"Calling `CoinbaseDataClient::new` (or the factory `new`) with credentials and a config whose environment, timeout, proxy URL, or retry config causes `CoinbaseHttpClient::new` to return Err — e.g. unparseable proxy URL, invalid environment enum, zero/invalid timeout.","commonSituations":"Misconfigured proxy_url (bad scheme or host), invalid environment string in config, an HTTP client build failure due to TLS/backend issues at process start.","solutions":["Inspect the wrapped `{e}` message in the log for the root cause from CoinbaseHttpClient::new","Check config.proxy_url is a valid URL (e.g. http://host:port) or None","Verify config.environment matches a supported Coinbase environment variant","Ensure http_timeout_secs is a sane positive value","Retry without the proxy to isolate proxy misconfiguration"],"exampleFix":"// before\nlet proxy_url = Some(\"socks5://\".to_string()); // invalid scheme\nCoinbaseDataClient::new(...)\n// after\nlet proxy_url = Some(\"http://127.0.0.1:8080\".to_string());\nCoinbaseDataClient::new(...)","handlingStrategy":"validation","validationCode":"if let Some(p) = &config.proxy_url {\n    if url::Url::parse(p).is_err() { panic!(\"invalid proxy_url: {p}\"); }\n}\nassert!(config.http_timeout_secs > 0);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate proxy URLs before constructing clients","Keep client config in one validated struct","Test client construction in CI with the same config used in prod"],"tags":["rust","http-client","config","coinbase","initialization"],"backgroundTag":"http-request-failed","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}