{"record":{"id":"023d10d78b3d6909","repo":"nautechsystems/nautilus_trader","slug":"failed-to-create-default-axrawhttpclient","errorCode":null,"errorMessage":"Failed to create default AxRawHttpClient","messagePattern":"Failed to create default AxRawHttpClient","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/adapters/architect_ax/src/http/client.rs","lineNumber":114,"sourceCode":"\n/// Raw HTTP client for low-level AX Exchange API operations.\n///\n/// This client handles request/response operations with the AX Exchange API,\n/// returning venue-specific response types. It does not parse to Nautilus domain types.\npub struct AxRawHttpClient {\n    base_url: String,\n    orders_base_url: String,\n    client: HttpClient,\n    credential: Option<Credential>,\n    session_token: RwLock<Option<SecretString>>,\n    retry_manager: RetryManager<AxHttpError>,\n    cancellation_token: RwLock<CancellationToken>,\n}\n\nimpl Default for AxRawHttpClient {\n    fn default() -> Self {\n        Self::new(None, None, 60, 3, 1000, 10_000, None)\n            .expect(\"Failed to create default AxRawHttpClient\")\n    }\n}\n\nimpl Debug for AxRawHttpClient {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        let has_session_token = self.session_token.read().is_some();\n        f.debug_struct(stringify!(AxRawHttpClient))\n            .field(\"base_url\", &self.base_url)\n            .field(\"orders_base_url\", &self.orders_base_url)\n            .field(\"has_credentials\", &self.credential.is_some())\n            .field(\"has_session_token\", &has_session_token)\n            .finish()\n    }\n}\n\nimpl AxRawHttpClient {\n    /// Returns the base URL for this client.\n    #[must_use]","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/architect_ax/src/http/client.rs#L96-L132","documentation":"AxRawHttpClient::default() delegates to new(None, None, 60, 3, 1000, 10_000, None) and unwraps the result with expect. If the constructor fails — typically because the default base URL cannot be parsed into a Url or a reqwest client cannot be built — the process panics with 'Failed to create default AxRawHttpClient'.","triggerScenarios":"Calling AxRawHttpClient::default() (or new with None URL) when the built-in default AX HTTP URL string fails to parse, or reqwest::Client::builder construction fails (e.g. TLS backend initialization failure).","commonSituations":"Running in an environment where the TLS/runtime backend fails to initialize; a renamed or malformed default URL constant after an adapter upgrade; using the Default impl in constrained environments (static binaries without proper TLS roots) instead of new() with explicit arguments.","solutions":["Replace AxRawHttpClient::default() with an explicit new(...) call and handle the returned Result instead of expecting success.","Pass an explicit valid base URL (and credentials) via new() rather than relying on the built-in default.","Check reqwest/TLS feature flags of the build (rustls vs native-tls) if client construction fails at startup.","If this appears after an adapter upgrade, check the release notes for a changed default URL constant."],"exampleFix":"// before\nlet client = AxRawHttpClient::default(); // panics on failure\n// after\nlet client = AxRawHttpClient::new(None, None, 60, 3, 1000, 10_000, None)\n    .unwrap_or_else(|e| panic!(\"init AxRawHttpClient failed: {e}\")); // or propagate Err","handlingStrategy":"try-catch","validationCode":"// Verify reqwest/TLS features are enabled in Cargo.toml and the default URL parses before relying on Default\nassert!(url::Url::parse(DEFAULT_AX_HTTP_URL).is_ok(), \"default AX URL invalid\");","typeGuard":null,"tryCatchPattern":"// Default() panics; avoid it. Use new() and handle Result:\nlet client = AxRawHttpClient::new(None, None, 60, 3, 1000, 10_000, None)\n    .map_err(|e| anyhow!(\"AxRawHttpClient init failed: {e}\"))?;","preventionTips":["Prefer explicit new(...) over Default in production code so construction errors are handleable.","Pin and review reqwest/TLS feature flags when building for new targets.","Smoke-test client construction at process startup with a clear failure message."],"tags":["http-client","panic","initialization","rust","architect-ax"],"backgroundTag":"module-init-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"}