nautechsystems/nautilus_trader · critical

All slug requests failed

Error message

All {total_slugs} slug requests failed

What it means

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.

Solutions

  1. Check network connectivity and that the Gamma API base URL is reachable (curl one slug endpoint manually).
  2. Retry after backoff — transient outages or rate limits often resolve; the function already retries per slug but total failure indicates a systemic issue.
  3. Verify the configured Gamma API endpoint/proxy settings for the environment.
  4. If rate limited, reduce concurrency and request rate, or add an API key if available.
  5. Inspect per-slug error logs from the loop to identify the shared root cause.

Example fix

// before: assuming a transient failure and returning empty
let instruments = fetch_instruments(&slugs).await.unwrap_or_default();
// after: surface the failure and retry with backoff
let instruments = match fetch_instruments(&slugs).await {
    Ok(i) if !i.is_empty() => i,
    Ok(_) | Err(_) if is_transient() => { sleep(BACKOFF); fetch_instruments(&slugs).await? },
    Err(e) => return Err(e),
};
Defensive patterns

Strategy: retry

Validate before calling

// Rust: probe the Gamma API health before a large slug batch
let probe = reqwest::get("https://gamma-api.polymarket.com/markets?slug=any-known-slug").await?;
assert!(probe.status().is_success(), "Gamma API unreachable");

Try / catch

// Rust
match fetch_instruments(&slugs).await {
    Ok(instruments) => Ok(instruments),
    Err(e) if is_network_error(&e) => {
        sleep(BACKOFF).await;
        fetch_instruments(&slugs).await
    }
    Err(e) => Err(e),
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/d78c1ef031996488. Report an issue: GitHub.

Appendix: source

Thrown at crates/adapters/polymarket/src/http/gamma.rs:593

        });

        let results = futures_util::future::join_all(futures).await;

        let total_slugs = results.len();
        let succeeded = results.iter().filter(|r| r.is_some()).count();
        let mut instruments = Vec::new();

        for result in results.into_iter().flatten() {
            let (slug, markets) = result;
            if markets.is_empty() {
                log::debug!("No markets found for slug '{slug}'");
                continue;
            }
            instruments.extend(parse_markets_to_instruments(&markets, ts_init));
        }

        if succeeded == 0 && total_slugs > 0 {
            anyhow::bail!("All {total_slugs} slug requests failed");
        }

        log::debug!("Parsed {} instruments from slug queries", instruments.len());
        Ok(instruments)
    }

    /// Fetches instruments for the given slugs with retry on empty results.
    ///
    /// Uses the client's [`RetryManager`] with exponential backoff. Gamma API
    /// may not have indexed a newly created market yet, so empty results are
    /// treated as retryable (indexing lag). HTTP errors are also retried per
    /// the standard `is_retryable()` classification.
    pub async fn request_instruments_by_slugs_with_retry(
        &self,
        slugs: Vec<String>,
    ) -> anyhow::Result<Vec<InstrumentAny>> {
        let inner = Arc::clone(&self.inner);
        let ts_init = self.clock.get_time_ns();

View on GitHub (pinned to 18893faf8b)