{"record":{"id":"78eebbafdcd1ffb7","repo":"nautechsystems/nautilus_trader","slug":"instrument-instrument-id-not-found-and-auto-loa","errorCode":null,"errorMessage":"Instrument {instrument_id} not found and `auto_load_missing_instruments` is disabled","messagePattern":"Instrument (.+?) not found and `auto_load_missing_instruments` is disabled","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/deribit/src/data.rs","lineNumber":457,"sourceCode":"    }\n\n    /// Sends data to the data channel.\n    fn send_data(sender: &tokio::sync::mpsc::UnboundedSender<DataEvent>, data: Data) {\n        if let Err(e) = sender.send(DataEvent::Data(data)) {\n            log::error!(\"Failed to send data: {e}\");\n        }\n    }\n\n    // Returns whether a subscribe should lazy-load the instrument before sending,\n    // erroring up front when the instrument is missing and the flag is disabled\n    // (so the WebSocket handler does not silently drop later frames).\n    fn prepare_subscribe(&self, instrument_id: InstrumentId) -> anyhow::Result<bool> {\n        if self.instruments.contains_key(&instrument_id) {\n            return Ok(false);\n        }\n\n        if !self.config.auto_load_missing_instruments {\n            anyhow::bail!(\n                \"Instrument {instrument_id} not found and `auto_load_missing_instruments` is disabled\"\n            );\n        }\n        Ok(true)\n    }\n\n    // Fetches an instrument over HTTP and seeds the local, HTTP, and WebSocket caches.\n    async fn lazy_load_instrument(\n        http_client: &DeribitHttpClient,\n        ws: &DeribitWebSocketClient,\n        instruments: &AtomicMap<InstrumentId, InstrumentAny>,\n        instrument_id: InstrumentId,\n    ) -> anyhow::Result<()> {\n        let instrument = http_client\n            .request_instrument(instrument_id)\n            .await\n            .with_context(|| format!(\"failed to lazy-load instrument {instrument_id}\"))?;\n        instruments.insert(instrument.id(), instrument.clone());","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/deribit/src/data.rs#L439-L475","documentation":"Before subscribing to any data stream, the adapter checks its local instrument cache. If the requested InstrumentId is not cached and config.auto_load_missing_instruments is false, it refuses to subscribe. The adapter will not silently fetch unknown instruments unless auto-loading was explicitly enabled.","triggerScenarios":"Calling subscribe_book_deltas / subscribe_book_depth10 / subscribe_quotes / subscribe_trades / subscribe_mark_prices / subscribe_index_prices with an InstrumentId that was never loaded via instrument loading (e.g. subscribe_instruments or config), while DeribitDataClientConfig.auto_load_missing_instruments is false (default).","commonSituations":"Using a symbol string with wrong case/format so the exact InstrumentId is not in the cache; subscribing before instruments were initialized; copying a config that disabled auto_load_missing_instruments; referencing a delisted or renamed Deribit instrument.","solutions":["Set auto_load_missing_instruments: true in DeribitDataClientConfig","Load the instrument first (e.g. subscribe to/load instruments for the venue before subscribing to data)","Verify the InstrumentId exactly matches a live Deribit instrument (case, expiry, underscore format)","Check the instrument still exists on Deribit (not expired/delisted)"],"exampleFix":"// before\nlet config = DeribitDataClientConfig { /* auto_load_missing_instruments: false */ .. };\n// after\nlet config = DeribitDataClientConfig {\n    auto_load_missing_instruments: true,\n    ..Default::default()\n};","handlingStrategy":"validation","validationCode":"if !config.auto_load_missing_instruments && !client.instruments.contains_key(&instrument_id) {\n    return Err(anyhow::anyhow!(\"load instrument {instrument_id} first or enable auto_load_missing_instruments\"));\n}","typeGuard":null,"tryCatchPattern":"match client.subscribe_quotes(cmd).await {\n    Err(e) if e.to_string().contains(\"not found\") => load_instrument_and_retry(),\n    other => other,\n}","preventionTips":["Enable auto_load_missing_instruments in DeribitDataClientConfig","Load instruments for the venue before subscribing to data","Validate InstrumentId strings against live Deribit instruments (case, format, expiry)"],"tags":["instrument","configuration","subscription","rust","deribit"],"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-14T00:17:10.932Z"}