{"record":{"id":"4c5f2cf3cd94267f","repo":"nautechsystems/nautilus_trader","slug":"instrument-instrument-id-not-found-in-cache","errorCode":null,"errorMessage":"Instrument {instrument_id} not found in cache","messagePattern":"Instrument (.+?) not found in cache","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/architect_ax/src/execution.rs","lineNumber":232,"sourceCode":"        let emitter = self.emitter.clone();\n        let clock = self.clock;\n\n        let http_client = self.http_client.clone();\n\n        self.spawn_task(\"submit_order\", async move {\n            // AX emulates market orders with preview-priced IOC limits, so book moves\n            // between preview and submission can produce partial fills.\n            let (price, submit_time_in_force, submit_post_only) = if order_type\n                == OrderType::Market\n            {\n                let preview_result: anyhow::Result<Price> = async {\n                    let symbol = instrument_id.symbol.inner();\n                    let ax_side = AxOrderSide::try_from(order_side)\n                        .map_err(|e| anyhow::anyhow!(\"Invalid order side: {e}\"))?;\n                    let qty_contracts = quantity_to_contracts(quantity)?;\n\n                    let instrument = http_client.get_instrument(&symbol).ok_or_else(|| {\n                        anyhow::anyhow!(\"Instrument {instrument_id} not found in cache\")\n                    })?;\n\n                    let request =\n                        PreviewAggressiveLimitOrderRequest::new(symbol, qty_contracts, ax_side);\n                    let response = http_client\n                        .inner\n                        .preview_aggressive_limit_order(&request)\n                        .await\n                        .map_err(|e| {\n                            anyhow::anyhow!(\"Failed to preview aggressive limit order: {e}\")\n                        })?;\n\n                    if response.remaining_quantity > 0 {\n                        log::warn!(\n                            \"Market order book depth insufficient: \\\n                             filled_qty={} remaining_qty={} for {instrument_id}\",\n                            response.filled_quantity,\n                            response.remaining_quantity,","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/architect_ax/src/execution.rs#L214-L250","documentation":"While pricing an emulated MARKET order, the adapter looks up the instrument in the HTTP client's instrument cache (populated when the data client connects and fetches instrument definitions). get_instrument(symbol) returning None means the symbol portion of the InstrumentId has no cached definition, so lot size and price precision are unknown and the preview request cannot be built. Submission aborts before reaching the venue.","triggerScenarios":"Submitting a market order before the AX data client finished loading instruments; using an InstrumentId whose symbol does not exactly match AX's symbol (case, dash, prefix differences); routing an order for another venue's instrument to the AX execution client; venue added new symbols after your session loaded instruments.","commonSituations":"Engine start race: trading logic fires on first bar before instruments are loaded; symbol spelled differently on AX than on the data source used for the signal (e.g. 'BTC-PERP' vs 'BTCUSD'); strategies shared across venues routed by a Router that sends the wrong instrument to AX.","solutions":["Verify the exact symbol with the AX instruments endpoint or the loaded cache and use that spelling in the InstrumentId (SYMBOL.AX)","Gate order submission until the data client is connected and the instrument exists (cache.instrument(id).is_some())","Ensure the AX data client for the same instruments is started before/at execution client start so definitions are fetched","Reload instruments (reconnect the data client) if the venue listed new symbols after startup"],"exampleFix":"// before: submits immediately, cache miss -> error\nself.submit_order(&order);\n// after: gate on instrument availability\nif self.cache.instrument(instrument.id).is_some() {\n    self.submit_order(&order);\n} else {\n    self.warning(&format!(\"{} not loaded yet, skipping\", instrument.id));\n}","handlingStrategy":"validation","validationCode":"// Gate market orders on a cached instrument definition\nif self.cache.instrument(instrument.id).is_none() {\n    self.warning(&format!(\n        \"instrument {} not loaded; deferring order\",\n        instrument.id\n    ));\n    return; // retry on a later signal/timer\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Start the AX data client for your instruments before the execution client sends orders","Log the exact InstrumentId you submit and diff it against the AX instruments list once at startup","Treat 'instrument not in cache' as a soft condition: skip and retry the signal, do not crash the strategy"],"tags":["architect-ax","instrument-not-found","cache","market-order","rust"],"backgroundTag":"instrument-not-found","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}