nautechsystems/nautilus_trader · error · anyhow::Error
unmapped_in_scope_message("open order", instrument_id, Some(
Error message
unmapped_in_scope_message("open order", instrument_id, Some(&format!("token {}", order.asset_id)), collection_load_ids,) What it means
During Polymarket reconciliation, an open order's token (asset_id) resolves to an instrument_id that is within the configured collection load scope, but that instrument was not actually loaded/mapped by the provider. Reconciliation bails (via unmapped_in_scope_message) because an in-scope instrument must be present for correct reporting.
Source
Thrown at crates/adapters/polymarket/src/execution/reconciliation.rs:597
OrderEvidenceScope::Collection { instrument_filter } => match instruments
.get_cloned(&order.asset_id)
{
Some(instrument) => instrument,
None => {
let instrument_id =
instrument_id_from_market_token(order.market.as_str(), order.asset_id.as_str());
if instrument_filter.is_some_and(|filter_id| {
!polymarket_instrument_ids_equivalent(filter_id, instrument_id)
}) {
return Ok(OrderRowResult {
report: None,
counted_filtered: false,
});
}
if instrument_in_load_ids_scope(instrument_id, collection_load_ids) {
anyhow::bail!(unmapped_in_scope_message(
"open order",
instrument_id,
Some(&format!("token {}", order.asset_id)),
collection_load_ids,
));
}
log::debug!("Dropping out-of-scope unmapped open order instrument {instrument_id}");
return Ok(OrderRowResult {
report: None,
counted_filtered: true,
});
}
},
};
let instrument_id = instrument.id();
if let OrderEvidenceScope::Collection {
instrument_filter: Some(filter_id),View on GitHub (pinned to d1527c24af)
Solutions
- Ensure all instruments in the configured load scope successfully loaded before reconciliation (check startup logs for fetch errors)
- Remove stale/delisted token IDs from load_ids
- Retry the connection so the instrument provider can repopulate missing definitions
Defensive patterns
Strategy: validation
Validate before calling
for id in collection_load_ids {
if cache.instrument(id).is_none() {
anyhow::bail!("configured instrument {id} not loaded; cannot reconcile in-scope orders");
}
} Prevention
- Confirm every load_ids entry resolved to a cached instrument before enabling reconciliation
- Treat startup instrument-fetch failures as blocking for reconciliation
- Prune delisted token IDs from the configured load scope
When it happens
Trigger: build_order_report_from_order with collection_load_ids containing the resolved instrument_id, yet the instrument is absent from the cache — e.g. load_ids lists a token that failed to load, or the token-to-instrument mapping drifted.
Common situations: Instrument load failures during startup (network errors fetching definitions); load_ids referencing delisted or renamed markets; partial cache population before reconciliation began.
Related errors
- unmapped_in_scope_message("position", instrument_id, None, c
- expected Polymarket BinaryOption instrument, found {instrume
- provider venue order {} is not owned by the account
- unmapped in-scope open order instrument {instrument_id} (tok
- unmapped in-scope position instrument {instrument_id}; {hint
AI-assisted analysis of nautechsystems/nautilus_trader@d1527c24af (2026-08-27).
Data as JSON: /api/errors/baa2179abb3c73aa.
Report an issue: GitHub.