{"record":{"id":"704c38e12b4c99a1","repo":"nautechsystems/nautilus_trader","slug":"failed-to-probe-market-closure-for-failed-chunks","errorCode":null,"errorMessage":"Failed to probe market closure for {failed_chunks} of {total_chunks} condition ID chunk(s)","messagePattern":"Failed to probe market closure for (.+?) of (.+?) condition ID chunk\\(s\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/polymarket/src/data/instruments.rs","lineNumber":496,"sourceCode":"                    updated.push(InstrumentAny::BinaryOption(binary.clone()));\n                }\n            }\n        });\n    }\n\n    for instrument in &updated {\n        let instrument_id = instrument.id();\n\n        // Retirement wins if the instrument was removed after the cache update\n        if let Some(latest) = cache.get_cloned(&instrument_id)\n            && let Err(e) = sender.send(DataEvent::Instrument(latest))\n        {\n            log::warn!(\"Failed to publish market closure update for {instrument_id}: {e}\");\n        }\n    }\n\n    if failed_chunks > 0 {\n        anyhow::bail!(\n            \"Failed to probe market closure for {failed_chunks} of {total_chunks} condition ID chunk(s)\"\n        );\n    }\n\n    Ok(updated.len())\n}\n\nimpl PolymarketDataClient {\n    pub(super) async fn bootstrap_instruments(&mut self) -> anyhow::Result<()> {\n        self.provider.initialize(false).await?;\n\n        let total = cache_and_publish_instruments(\n            &self.closed_condition_ids,\n            &self.instrument_update_state,\n            &self.instruments,\n            &self.token_meta,\n            &self.data_sender,\n            self.clock.get_time_ns(),","sourceCodeStart":478,"sourceCodeEnd":514,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/polymarket/src/data/instruments.rs#L478-L514","documentation":"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.","triggerScenarios":"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.","commonSituations":"Polymarket API outage or rate limiting during a data-client reconnect; transient network/DNS failures; too many condition IDs queried at once.","solutions":["Retry refresh_expired_market_closure after backoff; successful chunk results are retained, so a retry only re-probes failed chunks","Check connectivity/proxy settings and Polymarket API status","Reduce chunking pressure / add rate limiting if failures correlate with request volume","Inspect logged warnings for the underlying per-request errors"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// pre-check API reachability\nlet probe = reqwest::get(\"https://gamma-api.polymarket.com/markets?limit=1\").await;\nif probe.is_err() { log::warn!(\"Polymarket API unreachable, deferring closure refresh\"); }","typeGuard":null,"tryCatchPattern":"match refresh_expired_market_closure(&mut cache).await {\n    Ok(n) => log::info!(\"refreshed {n} instruments\"),\n    Err(e) => { log::warn!(\"partial refresh failure: {e}; retrying with backoff\"); schedule_retry(); }\n}","preventionTips":["Retry with exponential backoff; partial results are preserved across retries","Monitor Polymarket API status and rate limits","Alert on repeated chunk failures rather than treating one failure as fatal"],"tags":["polymarket","network","http","partial-failure"],"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"}