{"record":{"id":"a5919561e965bbe5","repo":"nautechsystems/nautilus_trader","slug":"failed-to-create-http-client-e","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/architect_ax/src/factories.rs","lineNumber":123,"sourceCode":"                ax_config.api_secret.clone().map(|value| value.into_inner()),\n            )\n            .ok_or_else(|| anyhow::anyhow!(\"API credentials not configured\"))?;\n\n            AxHttpClient::with_credentials(\n                credential.api_key().to_string(),\n                credential.api_secret().to_string(),\n                Some(ax_config.http_base_url()),\n                None, // orders_base_url\n                ax_config.http_timeout_secs,\n                ax_config.max_retries,\n                ax_config.retry_delay_initial_ms,\n                ax_config.retry_delay_max_ms,\n                ax_config\n                    .proxy_url\n                    .as_ref()\n                    .map(|url| url.expose_secret().to_owned()),\n            )\n            .map_err(|e| anyhow::anyhow!(\"Failed to create HTTP client: {e}\"))?\n        } else {\n            AxHttpClient::new(\n                Some(ax_config.http_base_url()),\n                None, // orders_base_url\n                ax_config.http_timeout_secs,\n                ax_config.max_retries,\n                ax_config.retry_delay_initial_ms,\n                ax_config.retry_delay_max_ms,\n                ax_config\n                    .proxy_url\n                    .as_ref()\n                    .map(|url| url.expose_secret().to_owned()),\n            )\n            .map_err(|e| anyhow::anyhow!(\"Failed to create HTTP client: {e}\"))?\n        };\n\n        let ws_url = ax_config.ws_public_url();\n","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/architect_ax/src/factories.rs#L105-L141","documentation":"When credentials are configured, the data factory builds an `AxHttpClient::with_credentials(...)`; any error constructing that client (bad base URL, invalid proxy URL, retry config) is wrapped as \"Failed to create HTTP client: {e}\". The inner `{e}` carries the concrete cause from the HTTP client constructor.","triggerScenarios":"`AxDataClientFactory.create` with valid credentials but a malformed `http_base_url`, an unparsable `proxy_url`, or a constructor failure such as TLS/runtime initialization inside `AxHttpClient::with_credentials`.","commonSituations":"Proxy set to a URL missing its scheme (e.g. `localhost:8080` without `http://`); base URL with a typo or trailing garbage; corporate proxy requiring auth that the simple URL form can't express.","solutions":["Inspect the wrapped `{e}` in the message for the root cause.","Fix `http_base_url` in the config to a valid absolute HTTP(S) URL.","Fix `proxy_url` to include a scheme, e.g. `http://proxy.corp:8080`, or remove it.","Verify `http_timeout_secs`, `max_retries`, and `retry_delay_max_ms` are sane non-degenerate values."],"exampleFix":"// before\nproxy_url: Some(\"localhost:8080\"), // no scheme\n\n// after\nproxy_url: Some(\"http://localhost:8080\"),","handlingStrategy":"validation","validationCode":"// before create\nlet base = ax_config.http_base_url();\nassert!(base.starts_with(\"http\"), \"http_base_url must include scheme: {base}\");\nif let Some(p) = &ax_config.proxy_url {\n    let p = p.expose_secret();\n    assert!(p.starts_with(\"http://\") || p.starts_with(\"https://\"), \"proxy_url needs scheme: {p}\");\n}\nassert!(ax_config.http_timeout_secs > 0);","typeGuard":null,"tryCatchPattern":"match factory.create(name, config, ...) {\n    Err(e) if e.to_string().starts_with(\"Failed to create HTTP client\") => {\n        eprintln!(\"HTTP client init failed: {e:#} — check base/proxy URLs and timeouts\");\n        Err(e)\n    }\n    other => other,\n}","preventionTips":["Always include the scheme in base and proxy URLs.","Smoke-test the base URL with curl before wiring it into the config.","Keep timeouts and retry values positive and realistic.","Dump the URL config (redacting secrets) at startup in debug mode."],"tags":["http","configuration","client-init","rust"],"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-23T08:17:48.524Z"}