nautechsystems/nautilus_trader · error

Instrument {instrument_id} not found on Polymarket

Error message

Instrument {instrument_id} not found on Polymarket

What it means

After loading instruments into the provider's store, the requested instrument_id is still absent, so load() fails. load() either loads filtered instruments or falls back to load_all, then checks the store; this error means the instrument does not exist on Polymarket or was not matched by the filters.

Source

Thrown at crates/adapters/polymarket/src/providers.rs:1151

                if self.store.contains(instrument_id) {
                    return Ok(());
                }
            }
        }

        // Fallback: full load_all if not initialized. A provider with an explicit
        // scope is excluded: `load_all` would broaden it into the full-universe
        // fetch that scoping exists to avoid, and would also clear the partially
        // loaded store and mark it initialized, making a later `initialize(false)`
        // skip the scopes it still owes after a failed bootstrap.
        if !self.store.is_initialized() && !self.config.has_explicit_scope() {
            self.load_all(filters).await?;
        }

        if self.store.contains(instrument_id) {
            Ok(())
        } else {
            anyhow::bail!("Instrument {instrument_id} not found on Polymarket")
        }
    }
}

#[cfg(test)]
mod tests {
    use rstest::rstest;

    use super::*;

    #[rstest]
    #[case("0xcondition-0xtoken", Some("0xtoken"))]
    #[case("0xcondition-with-dash-0xtoken", Some("0xtoken"))]
    #[case("0xcondition", None)]
    fn extracts_token_id_from_instrument_symbol(
        #[case] symbol: &str,
        #[case] expected: Option<&str>,
    ) {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Verify the instrument_id/slug exists on Polymarket (check via the Gamma API or the website)
  2. Remove or broaden the load filters so load_all/filters can fetch the market
  3. Check for typos and casing in the configured instrument IDs

Example fix

// before
provider.load("0x-wrong-address").await?;
// after
let id = look_up_instrument_id_from_gamma("real-slug").await?;
provider.load(&id).await?;
Defensive patterns

Strategy: fallback

Validate before calling

if !provider.store_contains(&instrument_id) {
    eprintln!("{instrument_id} not cached; verify slug/address via Gamma API first");
}

Try / catch

match provider.load(&instrument_id).await {
    Err(e) if e.to_string().contains("not found on Polymarket") => {
        // verify the market exists / clear filters, then retry
    }
    r => r?,
}

Prevention

When it happens

Trigger: Calling provider.load(instrument_id) (directly or via instrument provider initialization) with an ID whose slug/market does not exist, is closed, or was filtered out by the configured load filters.

Common situations: Typo in the instrument ID or slug; market resolved/delisted since config was written; load filters too narrow so the fallback load_all is skipped; network returned data that didn't include the market.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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