{"record":{"id":"06289b0c11d8305c","repo":"nautechsystems/nautilus_trader","slug":"instrumentlookuperror-not-found-instrument-id-06289b","errorCode":null,"errorMessage":"InstrumentLookupError::not_found(instrument_id)","messagePattern":"InstrumentLookupError::not_found\\(instrument_id\\)","errorType":"exception","errorClass":"InstrumentLookupError","httpStatus":null,"severity":"error","filePath":"crates/adapters/derive/src/data.rs","lineNumber":569,"sourceCode":"        instruments: Arc<AtomicMap<InstrumentId, InstrumentAny>>,\n        instrument_id: InstrumentId,\n        include_expired: bool,\n    ) -> anyhow::Result<()> {\n        let currency = currency_from_instrument_id(&instrument_id)?;\n        let definitions = fetch_instrument_definitions(&http_client, currency, include_expired)\n            .await\n            .with_context(|| format!(\"failed to lazy-load Derive instruments for {currency}\"))?;\n        let mut found = false;\n\n        for instrument in parse_instrument_definitions(definitions) {\n            if instrument.id() == instrument_id {\n                found = true;\n            }\n            cache_instrument(&instruments, &instrument);\n        }\n\n        if !found {\n            anyhow::bail!(InstrumentLookupError::not_found(instrument_id));\n        }\n\n        Ok(())\n    }\n\n    fn ws_handle(&self) -> DeriveWebSocketSubscriptionHandle {\n        self.ws_client.subscription_handle()\n    }\n\n    fn subscription_lifecycle(&self) -> SubscriptionLifecycle {\n        SubscriptionLifecycle {\n            registry: Arc::clone(&self.channel_subscriptions),\n            lock: Arc::clone(&self.subscription_lock),\n            dispatch: SubscriptionDispatchState {\n                active_book_delta_channels: Arc::clone(&self.active_book_delta_channels),\n                active_book_depth10_channels: Arc::clone(&self.active_book_depth10_channels),\n                active_ticker_channels: Arc::clone(&self.active_ticker_channels),\n                active_quote_subs: Arc::clone(&self.active_quote_subs),","sourceCodeStart":551,"sourceCodeEnd":587,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/derive/src/data.rs#L551-L587","documentation":"Raised by `lazy_load_instrument` after fetching instrument data from Derive when no returned instrument matches the requested instrument_id. It wraps `InstrumentLookupError::not_found`, meaning the exchange query succeeded but the specific instrument does not exist (or is not tradable/listed).","triggerScenarios":"Auto-loading (`auto_load_missing_instruments: true`) an InstrumentId during prepare_subscribe where lazy_load_instrument queries Derive for the instrument type/currency but the matching instrument is absent from the response.","commonSituations":"Requesting delisted or expired instruments; misspelled or wrong-format symbols; requesting an instrument whose underlying currency isn't covered by the query used; instruments on a different Derive sub-market.","solutions":["Verify the InstrumentId symbol exists and is active on Derive (check symbol format and case).","Confirm the instrument is not expired/delisted; use a current instrument.","Ensure configured currencies/instrument-type filters cover the requested instrument.","Add the instrument explicitly via request_instruments and check the response before subscribing."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"// verify instrument exists on Derive before lazy load\nlet exists = derive_rest_instrument_exists(&symbol, &currency)?;","typeGuard":null,"tryCatchPattern":"if let Err(e) = lazy_load_instrument(instrument_id).await {\n    log::warn!(\"{e}; skipping subscription for {instrument_id}\");\n    return Ok(()); // degrade gracefully instead of failing the subscribe\n}","preventionTips":["Check instrument is active and not expired on Derive.","Keep configured currencies/instrument-type filters in sync with traded instruments.","Validate symbol format (venue, base-quote, kind suffix) before requesting."],"tags":["instrument-lookup","not-found","derive","subscription"],"backgroundTag":"entity-not-found","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}