{"record":{"id":"d78c1ef031996488","repo":"nautechsystems/nautilus_trader","slug":"all-total-slugs-slug-requests-failed","errorCode":null,"errorMessage":"All {total_slugs} slug requests failed","messagePattern":"All (.+?) slug requests failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/adapters/polymarket/src/http/gamma.rs","lineNumber":593,"sourceCode":"        });\n\n        let results = futures_util::future::join_all(futures).await;\n\n        let total_slugs = results.len();\n        let succeeded = results.iter().filter(|r| r.is_some()).count();\n        let mut instruments = Vec::new();\n\n        for result in results.into_iter().flatten() {\n            let (slug, markets) = result;\n            if markets.is_empty() {\n                log::debug!(\"No markets found for slug '{slug}'\");\n                continue;\n            }\n            instruments.extend(parse_markets_to_instruments(&markets, ts_init));\n        }\n\n        if succeeded == 0 && total_slugs > 0 {\n            anyhow::bail!(\"All {total_slugs} slug requests failed\");\n        }\n\n        log::debug!(\"Parsed {} instruments from slug queries\", instruments.len());\n        Ok(instruments)\n    }\n\n    /// Fetches instruments for the given slugs with retry on empty results.\n    ///\n    /// Uses the client's [`RetryManager`] with exponential backoff. Gamma API\n    /// may not have indexed a newly created market yet, so empty results are\n    /// treated as retryable (indexing lag). HTTP errors are also retried per\n    /// the standard `is_retryable()` classification.\n    pub async fn request_instruments_by_slugs_with_retry(\n        &self,\n        slugs: Vec<String>,\n    ) -> anyhow::Result<Vec<InstrumentAny>> {\n        let inner = Arc::clone(&self.inner);\n        let ts_init = self.clock.get_time_ns();","sourceCodeStart":575,"sourceCodeEnd":611,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/polymarket/src/http/gamma.rs#L575-L611","documentation":"request_instruments_by_slugs issues one market request per slug (with concurrency and retries). If every single slug request failed (succeeded == 0 while total_slugs > 0), the adapter bails rather than returning a silently empty instrument set; partial failures still return the successfully parsed instruments.","triggerScenarios":"Calling request_instruments_by_slugs (directly or via fetch_instruments / fetch_configured_instruments) when the network, DNS, rate limiting, or Gamma API availability causes all slug lookups to fail.","commonSituations":"No internet or DNS outage; Gamma API down or returning 5xx; aggressive rate limiting exhausting retries; an unreachable or misconfigured GAMMA_API base URL (e.g. wrong proxy env var); firewall blocking the host in CI.","solutions":["Check network connectivity and that the Gamma API base URL is reachable (curl one slug endpoint manually).","Retry after backoff — transient outages or rate limits often resolve; the function already retries per slug but total failure indicates a systemic issue.","Verify the configured Gamma API endpoint/proxy settings for the environment.","If rate limited, reduce concurrency and request rate, or add an API key if available.","Inspect per-slug error logs from the loop to identify the shared root cause."],"exampleFix":"// before: assuming a transient failure and returning empty\nlet instruments = fetch_instruments(&slugs).await.unwrap_or_default();\n// after: surface the failure and retry with backoff\nlet instruments = match fetch_instruments(&slugs).await {\n    Ok(i) if !i.is_empty() => i,\n    Ok(_) | Err(_) if is_transient() => { sleep(BACKOFF); fetch_instruments(&slugs).await? },\n    Err(e) => return Err(e),\n};","handlingStrategy":"retry","validationCode":"// Rust: probe the Gamma API health before a large slug batch\nlet probe = reqwest::get(\"https://gamma-api.polymarket.com/markets?slug=any-known-slug\").await?;\nassert!(probe.status().is_success(), \"Gamma API unreachable\");","typeGuard":null,"tryCatchPattern":"// Rust\nmatch fetch_instruments(&slugs).await {\n    Ok(instruments) => Ok(instruments),\n    Err(e) if is_network_error(&e) => {\n        sleep(BACKOFF).await;\n        fetch_instruments(&slugs).await\n    }\n    Err(e) => Err(e),\n}","preventionTips":["Verify network/DNS/proxy access to gamma-api.polymarket.com before large batches.","Throttle slug request concurrency to avoid triggering rate limits.","Monitor the Gamma API status; treat total failure as an environment problem, not a data problem.","Check the GAMMA API base-URL configuration when running in restricted environments like CI."],"tags":["polymarket","gamma-api","network","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-14T05:17:10.506Z"}