{"record":{"id":"baa2179abb3c73aa","repo":"nautechsystems/nautilus_trader","slug":"unmapped-in-scope-message-open-order-instrument","errorCode":null,"errorMessage":"unmapped_in_scope_message(\"open order\", instrument_id, Some(&format!(\"token {}\", order.asset_id)), collection_load_ids,)","messagePattern":"unmapped_in_scope_message\\(\"open order\", instrument_id, Some\\(&format!\\(\"token (.+?)\", order\\.asset_id\\)\\), collection_load_ids,\\)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/polymarket/src/execution/reconciliation.rs","lineNumber":597,"sourceCode":"        OrderEvidenceScope::Collection { instrument_filter } => match instruments\n            .get_cloned(&order.asset_id)\n        {\n            Some(instrument) => instrument,\n            None => {\n                let instrument_id =\n                    instrument_id_from_market_token(order.market.as_str(), order.asset_id.as_str());\n\n                if instrument_filter.is_some_and(|filter_id| {\n                    !polymarket_instrument_ids_equivalent(filter_id, instrument_id)\n                }) {\n                    return Ok(OrderRowResult {\n                        report: None,\n                        counted_filtered: false,\n                    });\n                }\n\n                if instrument_in_load_ids_scope(instrument_id, collection_load_ids) {\n                    anyhow::bail!(unmapped_in_scope_message(\n                        \"open order\",\n                        instrument_id,\n                        Some(&format!(\"token {}\", order.asset_id)),\n                        collection_load_ids,\n                    ));\n                }\n                log::debug!(\"Dropping out-of-scope unmapped open order instrument {instrument_id}\");\n                return Ok(OrderRowResult {\n                    report: None,\n                    counted_filtered: true,\n                });\n            }\n        },\n    };\n    let instrument_id = instrument.id();\n\n    if let OrderEvidenceScope::Collection {\n        instrument_filter: Some(filter_id),","sourceCodeStart":579,"sourceCodeEnd":615,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/d1527c24afdf475115785557f89a55c3e336c51f/crates/adapters/polymarket/src/execution/reconciliation.rs#L579-L615","documentation":"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.","triggerScenarios":"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.","commonSituations":"Instrument load failures during startup (network errors fetching definitions); load_ids referencing delisted or renamed markets; partial cache population before reconciliation began.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"for id in collection_load_ids {\n    if cache.instrument(id).is_none() {\n        anyhow::bail!(\"configured instrument {id} not loaded; cannot reconcile in-scope orders\");\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["polymarket","reconciliation","instrument-loading","scope"],"backgroundTag":"out-of-scope-instrument","analyzedSha":"d1527c24afdf475115785557f89a55c3e336c51f","analyzedAt":"2026-08-27T04:01:12.327Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}