{"record":{"id":"dd6be1f0e01b8c18","repo":"nautechsystems/nautilus_trader","slug":"failed-to-create-data-api-http-client","errorCode":null,"errorMessage":"failed to create Data API HTTP client","messagePattern":"failed to create Data API HTTP client","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/polymarket/src/execution/mod.rs","lineNumber":157,"sourceCode":"            &signer_address,\n            secrets.funder.as_deref(),\n        )?;\n        let http_client = PolymarketClobHttpClient::new_with_proxy(\n            secrets.credential.clone(),\n            signer_address.clone(),\n            config.base_url_http.clone(),\n            config.http_timeout_secs,\n            proxy_url.clone(),\n        )\n        .map_err(|e| anyhow::anyhow!(\"{e}\"))\n        .context(\"failed to create CLOB HTTP client\")?;\n\n        let data_api_client = PolymarketDataApiHttpClient::new_with_proxy(\n            Some(config.data_api_url()),\n            config.http_timeout_secs,\n            proxy_url.clone(),\n        )\n        .map_err(|e| anyhow::anyhow!(\"{e}\"))\n        .context(\"failed to create Data API HTTP client\")?;\n\n        let order_signer =\n            OrderSigner::new(&secrets.private_key).context(\"failed to create order signer\")?;\n        let order_builder = Arc::new(PolymarketOrderBuilder::new(\n            order_signer,\n            signer_address,\n            maker_address,\n            config.signature_type,\n        ));\n\n        let retry_config = RetryConfig {\n            max_retries: config.max_retries,\n            initial_delay_ms: config.retry_delay_initial_ms,\n            max_delay_ms: config.retry_delay_max_ms,\n            backoff_factor: 2.0,\n            jitter_ms: 1_000,\n            operation_timeout_ms: Some(config.http_timeout_secs * 1_000),","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/polymarket/src/execution/mod.rs#L139-L175","documentation":"Alongside the CLOB client, `new` constructs a `PolymarketDataApiHttpClient` pointed at `config.data_api_url()`. Failure to build that client (bad URL, timeout, or proxy) is wrapped with this context. The execution client cannot initialize without it since account-state and market data fetches depend on the Data API.","triggerScenarios":"Invalid data_api_url produced by config.data_api_url() (misconfigured data API base URL); invalid http_timeout_secs; unparseable proxy_url passed to new_with_proxy.","commonSituations":"Wrong POLYMARKET_DATA_API_URL config value or typo in the default; proxy misconfiguration affecting only the data API path; env-specific override pointing to a non-URL string.","solutions":["Verify the data API base URL config is a valid absolute URL (e.g. https://data-api.polymarket.com)","Check proxy_url validity (scheme + host + port) or disable the proxy","Validate http_timeout_secs is positive","Compare against the default data_api_url to find the bad override","Read the inner `{e}` for the precise parse failure"],"exampleFix":"// before\ndata_api_url: \"data-api.polymarket.com\".into(), // no scheme\n// after\ndata_api_url: \"https://data-api.polymarket.com\".into(),","handlingStrategy":"validation","validationCode":"fn validate_data_api_url(cfg: &PolymarketExecConfig) -> Result<(), String> {\n    let url = cfg.data_api_url();\n    if !url.starts_with(\"https://\") { return Err(format!(\"data API URL invalid: {url}\")); }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"let client = PolymarketExecutionClient::new(...)\n    .map_err(|e| { tracing::error!(\"data api init: {e:#}\"); e })?;","preventionTips":["Verify data API URL overrides against the documented default","Apply the same proxy validation to all HTTP clients","Smoke-test client construction at startup, before trading"],"tags":["rust","http","config","client-init"],"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"}