nautechsystems/nautilus_trader · error
Failed to create HTTP client: {e}
Error message
Failed to create HTTP client: {e} What it means
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.
Source
Thrown at crates/adapters/coinbase/src/data/mod.rs:142
.proxy_url
.as_ref()
.map(|value| value.expose_secret().to_owned());
let http_client = match CoinbaseCredential::resolve(
config.api_key.as_ref().map(|value| value.expose_secret()),
config
.api_secret
.as_ref()
.map(|value| value.expose_secret()),
) {
Some(credential) => CoinbaseHttpClient::with_credentials(
credential,
config.environment,
config.http_timeout_secs,
proxy_url.clone(),
Some(retry_config),
)
.map_err(|e| anyhow::anyhow!("Failed to create HTTP client: {e}"))?,
None => CoinbaseHttpClient::new(
config.environment,
config.http_timeout_secs,
proxy_url.clone(),
Some(retry_config),
)
.map_err(|e| anyhow::anyhow!("Failed to create HTTP client: {e}"))?,
};
if let Some(url) = &config.base_url_rest {
http_client.set_base_url(url.clone());
}
let ws_url = config.ws_url();
let ws_client = CoinbaseWebSocketClient::new(&ws_url, config.transport_backend, proxy_url)
.with_socket_control(SocketControl::new(
client_id,
Some(*COINBASE_VENUE),View on GitHub (pinned to 18893faf8b)
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
Example fix
// before
let proxy_url = Some("socks5://".to_string()); // invalid scheme
CoinbaseDataClient::new(...)
// after
let proxy_url = Some("http://127.0.0.1:8080".to_string());
CoinbaseDataClient::new(...) Defensive patterns
Strategy: validation
Validate before calling
if let Some(p) = &config.proxy_url {
if url::Url::parse(p).is_err() { panic!("invalid proxy_url: {p}"); }
}
assert!(config.http_timeout_secs > 0); Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- Failed to create Coinbase HTTP client: {e}
- Failed to create config instance. Tried kwargs: {kwargs_err}
- Failed to create HTTP client {i}: {e}
- Failed to create HTTP client {i}: {e}
- Failed to create default AxRawHttpClient
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/fe21b61b6abc2752.
Report an issue: GitHub.