nautechsystems/nautilus_trader · error
All {total} event slug requests failed
Error message
All {total} event slug requests failed What it means
request_instruments_by_event_slugs fetches Gamma markets for a batch of event slugs and counts how many slug requests succeeded. If every request in the batch failed (succeeded == 0) while at least one slug was requested, it aborts with this error instead of returning an empty instrument set. This guards against silently treating a total API outage or bad slugs as 'no instruments'.
Source
Thrown at crates/adapters/polymarket/src/http/gamma.rs:703
let results = futures_util::future::join_all(futures).await;
let total = 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, events) = result;
let markets = flatten_event_markets(events);
if markets.is_empty() {
log::warn!("No markets found in event slug '{slug}'");
continue;
}
instruments.extend(parse_markets_to_instruments(&markets, ts_init));
}
if succeeded == 0 && total > 0 {
anyhow::bail!("All {total} event slug requests failed");
}
log::debug!(
"Parsed {} instruments from event slug queries",
instruments.len()
);
Ok(instruments)
}
/// Fetches instruments using arbitrary Gamma API query params with auto-pagination.
pub async fn request_instruments_by_params(
&self,
base_params: GetGammaMarketsParams,
) -> anyhow::Result<Vec<InstrumentAny>> {
let markets = self.fetch_gamma_markets_paginated(base_params).await?;
let ts_init = self.clock.get_time_ns();
let instruments = parse_markets_to_instruments(&markets, ts_init);
log::debug!("Parsed {} instruments from params query", instruments.len());View on GitHub (pinned to 18893faf8b)
Solutions
- Verify network connectivity and that the Gamma API endpoint URL is correct/reachable (curl the endpoint).
- Check the event slugs passed to fetch_instruments/fetch_configured_instruments are valid, current Polymarket event slugs.
- Check logs for the per-slug error just above the bail to identify the underlying HTTP failure (auth, 429, 404).
- Add retry/backoff around the slug requests if failures are transient (rate limits, temporary outages).
Example fix
// before: single shot per slug request
let resp = client.get(url).send()?;
// after: retry transient failures
let resp = client.get(url).send()?;
let resp = match resp.error_for_status() {
Ok(r) => r,
Err(e) if attempt < 3 => { sleep(backoff); continue; }
Err(e) => return Err(e.into()),
}; Defensive patterns
Strategy: retry
Validate before calling
// precondition check before calling fetch_instruments
assert!(!event_slugs.is_empty(), "no event slugs configured");
// optionally probe the API first
let health = reqwest::get("https://gamma-api.polymarket.com/events?limit=1").await?;
if !health.status().is_success() { return Err("gamma api unreachable".into()); } Try / catch
match adapter.fetch_instruments().await {
Ok(instruments) => instruments,
Err(e) if e.to_string().contains("All ") && e.to_string().contains("failed") => {
log::warn!("gamma api batch failed entirely; retrying with backoff");
backoff_retry(|| adapter.fetch_instruments()).await?
}
Err(e) => return Err(e),
} Prevention
- Monitor Gamma API health/uptime before starting the adapter.
- Validate configured event slugs against the API at startup.
- Use exponential backoff with jitter for slug requests.
When it happens
Trigger: Calling fetch_instruments or fetch_configured_instruments where every event slug query to the Polymarket Gamma API fails (network errors, non-200 responses, or unparseable bodies) while total > 0.
Common situations: Polymarket API outage or rate limiting; wrong or expired event slugs in adapter config; no network access / DNS failure in a container; Gamma API URL misconfigured via environment variables.
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
- Failed to probe market closure for {failed_chunks} of {total
- Failed to fetch order book: {e}
- Failed to fetch order status: {e}
- All {total_slugs} slug requests failed
- Expected BinaryOption, was {other:?}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/cb5b6c96642c43b9.
Report an issue: GitHub.