{"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":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/architect_ax/src/execution.rs","lineNumber":255,"sourceCode":"        let trader_id = self.core.trader_id;\n        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::from(order_side);\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":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/architect_ax/src/execution.rs#L237-L273","documentation":"Raised in `submit_order_internal` (via `submit_order`) when the AX HTTP client cannot return the instrument definition for the order's symbol. The adapter calls `http_client.get_instrument(&symbol)` while preparing an aggressive (marketable) limit order preview, and `ok_or_else` converts the missing instrument into this error. The adapter cannot compute contract quantities or price precision without the instrument definition.","triggerScenarios":"Submitting a MARKET (aggressive limit) order for an instrument whose symbol is not resolvable by `get_instrument` on the AX HTTP API: unknown/misspelled symbol, instrument not listed on AX, or the HTTP lookup fails/returns nothing.","commonSituations":"Order placed on an instrument ID that belongs to a different venue; symbol format mismatch between internal instrument ID and AX's expected symbol; instrument delisted or not yet loaded into the cache; HTTP client misconfigured pointing at wrong environment.","solutions":["Verify the instrument ID's symbol exists on the Architect AX venue and matches AX's symbol conventions.","Confirm the instrument is registered/loadable in the cache before submitting orders (subscribe to the instrument or load it at startup).","Check that the HTTP client points to the intended AX environment (prod vs test) where the instrument is listed.","Ensure the symbol string passed to `get_instrument` is exact (no whitespace, correct casing).","If the instrument was recently listed/delisted, refresh the instrument metadata."],"exampleFix":"// before\nlet qty = Quantity::from(1);\nengine.submit_order(order);  // instrument never loaded for this venue\n// after\nif client.get_instrument(&symbol).is_none() {\n    return Err(anyhow::anyhow!(\"load or register instrument {symbol} first\"));\n}\nengine.submit_order(order);","handlingStrategy":"validation","validationCode":"let symbol = instrument_id.symbol.inner();\nif http_client.get_instrument(&symbol).is_none() {\n    anyhow::bail!(\"instrument {instrument_id} unavailable on AX; register or refresh before trading\");\n}","typeGuard":null,"tryCatchPattern":"match engine.submit_order(order) {\n    Err(e) if e.to_string().contains(\"not found in cache\") => {\n        log::error!(\"load AX instrument metadata for {} before submitting\", order.instrument_id());\n    }\n    other => other?,\n}","preventionTips":["Load/subscribe instrument definitions for every symbol you intend to trade before the session starts.","Keep venue and symbol conventions consistent; never mix venue instrument IDs.","Refresh instrument metadata when symbols are newly listed or delisted.","Point the HTTP client at the same environment as the trading instruments."],"tags":["instrument","not-found","orders","cache"],"backgroundTag":"resource-not-found","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}