nautechsystems/nautilus_trader · critical
Failed to create default AxHttpClient
Error message
Failed to create default AxHttpClient
What it means
AxHttpClient::default() calls new(None, None, 60, 3, 1000, 10_000, None) and expects success, panicking with 'Failed to create default AxHttpClient' if the underlying construction — default URL parsing and reqwest client building (which also constructs the raw client internally) — returns Err.
Source
Thrown at crates/adapters/architect_ax/src/http/client.rs:1162
account_fees: Arc<ArcSwapOption<(Decimal, Decimal)>>,
}
impl Clone for AxHttpClient {
fn clone(&self) -> Self {
Self {
inner: self.inner.clone(),
instruments_cache: self.instruments_cache.clone(),
cache_initialized: self.cache_initialized.clone(),
clock: self.clock,
account_fees: self.account_fees.clone(),
}
}
}
impl Default for AxHttpClient {
fn default() -> Self {
Self::new(None, None, 60, 3, 1000, 10_000, None)
.expect("Failed to create default AxHttpClient")
}
}
impl AxHttpClient {
/// Creates a new [`AxHttpClient`] using the default Ax HTTP URL.
///
/// # Errors
///
/// Returns an error if the retry manager cannot be created.
pub fn new(
base_url: Option<String>,
orders_base_url: Option<String>,
timeout_secs: u64,
max_retries: u32,
retry_delay_ms: u64,
retry_delay_max_ms: u64,
proxy_url: Option<String>,
) -> Result<Self, AxHttpError> {View on GitHub (pinned to 18893faf8b)
Solutions
- Use AxHttpClient::new(...) explicitly and handle its Result instead of Default's expect.
- Supply an explicit base URL and credentials through new() to rule out default-constant issues.
- Verify reqwest TLS features (rustls vs native-tls) and that the binary links them correctly.
- Confirm the default URL constant is still valid after upgrading the adapter crate.
Example fix
// before let client = AxHttpClient::default(); // panics on failure // after let client = AxHttpClient::new(None, None, 60, 3, 1000, 10_000, None)?; // propagate the error
Defensive patterns
Strategy: try-catch
Validate before calling
// Ensure the default URL is parseable and TLS backend available before Default-based construction assert!(url::Url::parse(DEFAULT_AX_HTTP_URL).is_ok(), "default AX URL invalid");
Try / catch
// Avoid Default()'s expect; construct explicitly and handle the error:
let client = AxHttpClient::new(None, None, 60, 3, 1000, 10_000, None)
.map_err(|e| anyhow!("AxHttpClient init failed: {e}"))?; Prevention
- Use AxHttpClient::new with explicit arguments instead of Default in services.
- Run a startup health check that constructs the client once before trading begins.
- After adapter upgrades, re-verify the built-in default URL constant.
When it happens
Trigger: Calling AxHttpClient::default() when the built-in default AX HTTP URL fails to parse, or the internal reqwest/AxRawHttpClient construction fails (TLS/runtime initialization problems).
Common situations: Startup of the AX adapter in environments where reqwest's TLS backend cannot initialize; relying on Default in tests or binaries after an adapter version changed the default URL; miscompiled reqwest feature set.
Related errors
- Failed to create default AxRawHttpClient
- Failed to create default Hyperliquid HTTP client
- Latency model should be initialized
- Execution client should be initialized
- Failed to create HTTP client {i}: {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/e2648f8aaa73e9ff.
Report an issue: GitHub.