nautechsystems/nautilus_trader · error

Failed to probe market closure for {failed_chunks} of {total

Error message

Failed to probe market closure for {failed_chunks} of {total_chunks} condition ID chunk(s)

What it means

refresh_expired_market_closure probes Polymarket market closure status in chunks of condition IDs; if any chunk request fails, it logs per-instrument warnings and then bails summarizing how many chunks failed, after still applying results from successful chunks.

Source

Thrown at crates/adapters/polymarket/src/data/instruments.rs:496

                    updated.push(InstrumentAny::BinaryOption(binary.clone()));
                }
            }
        });
    }

    for instrument in &updated {
        let instrument_id = instrument.id();

        // Retirement wins if the instrument was removed after the cache update
        if let Some(latest) = cache.get_cloned(&instrument_id)
            && let Err(e) = sender.send(DataEvent::Instrument(latest))
        {
            log::warn!("Failed to publish market closure update for {instrument_id}: {e}");
        }
    }

    if failed_chunks > 0 {
        anyhow::bail!(
            "Failed to probe market closure for {failed_chunks} of {total_chunks} condition ID chunk(s)"
        );
    }

    Ok(updated.len())
}

impl PolymarketDataClient {
    pub(super) async fn bootstrap_instruments(&mut self) -> anyhow::Result<()> {
        self.provider.initialize(false).await?;

        let total = cache_and_publish_instruments(
            &self.closed_condition_ids,
            &self.instrument_update_state,
            &self.instruments,
            &self.token_meta,
            &self.data_sender,
            self.clock.get_time_ns(),

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Retry refresh_expired_market_closure after backoff; successful chunk results are retained, so a retry only re-probes failed chunks
  2. Check connectivity/proxy settings and Polymarket API status
  3. Reduce chunking pressure / add rate limiting if failures correlate with request volume
  4. Inspect logged warnings for the underlying per-request errors
Defensive patterns

Strategy: retry

Validate before calling

// pre-check API reachability
let probe = reqwest::get("https://gamma-api.polymarket.com/markets?limit=1").await;
if probe.is_err() { log::warn!("Polymarket API unreachable, deferring closure refresh"); }

Try / catch

match refresh_expired_market_closure(&mut cache).await {
    Ok(n) => log::info!("refreshed {n} instruments"),
    Err(e) => { log::warn!("partial refresh failure: {e}; retrying with backoff"); schedule_retry(); }
}

Prevention

When it happens

Trigger: One or more HTTP requests to Polymarket's gamma/markets API fail (network error, non-2xx, timeout) while refreshing expired instruments' closure status; failed_chunks > 0 out of total_chunks.

Common situations: Polymarket API outage or rate limiting during a data-client reconnect; transient network/DNS failures; too many condition IDs queried at once.

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/704c38e12b4c99a1. Report an issue: GitHub.