nautechsystems/nautilus_trader · error
{e}
Error message
{e} What it means
request_instruments_by_slugs_with_retry executes the retried Gamma API request and maps any remaining error into anyhow with this message. It means the instrument fetch from the Gamma /events endpoint failed after retry attempts.
Source
Thrown at crates/adapters/polymarket/src/http/gamma.rs:660
parse_markets_to_instruments(&markets, ts_init)
})
.collect();
if instruments.is_empty() {
return Err(Error::transport(
"Gamma returned no instruments (indexing lag)",
));
}
Ok(instruments)
}
},
|e| e.is_retryable(),
|e| Error::transport(e.to_string()),
)
.execute()
.await
.map_err(|e| anyhow::anyhow!("{e}"))
}
/// Fetches instruments from event slugs concurrently.
///
/// Each slug queries `GET /events?slug=`, extracts the markets array from
/// the first matching event, and parses each market into instruments.
pub async fn request_instruments_by_event_slugs(
&self,
event_slugs: Vec<String>,
) -> anyhow::Result<Vec<InstrumentAny>> {
let ts_init = self.clock.get_time_ns();
let futures = event_slugs.into_iter().map(|slug| {
let inner = Arc::clone(&self.inner);
async move {
match inner.get_gamma_events_by_slug(&slug).await {
Ok(events) => Some((slug, events)),
Err(e) => {View on GitHub (pinned to 18893faf8b)
Solutions
- Read the wrapped error {e} for the underlying cause (transport vs HTTP status vs retry exhaustion).
- Confirm the slug values are correct and the Gamma endpoint is reachable.
- Increase retry attempts/backoff or handle non-retryable Error variants explicitly before retrying.
Defensive patterns
Strategy: retry
Validate before calling
for slug in &slugs { if slug.is_empty() { bail!("empty slug"); } } Try / catch
match request_instruments_by_slugs_with_retry(slugs).await {
Ok(instruments) => instruments,
Err(e) => { error!("gamma instruments fetch failed after retries: {e}"); Vec::new() }
} Prevention
- Validate slugs before issuing requests.
- Keep the retry policy's is_retryable predicate aligned with which errors are genuinely transient.
- Set alerting on Gamma API failure rates to catch outages early.
When it happens
Trigger: Calling request_instruments_by_slugs_with_retry when every retry fails — e.g. persistent transport errors, non-retryable HTTP errors, or the retry policy exhausting its attempts against GET /events?slug=.
Common situations: Gamma API outage, rate limiting beyond the retry budget, invalid slugs causing repeated HTTP errors, or network/proxy misconfiguration in the deployment environment.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
- Failed to fetch order status: {e}
- {e}
- Modify order failed: {e}
- Either client_order_id or venue_order_id is required
- Failed to connect after {max_attempts} attempts
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/6d35d0297fb13075.
Report an issue: GitHub.