{"record":{"id":"2b52e3954d1b7c35","repo":"nautechsystems/nautilus_trader","slug":"failed-to-decode-instrument-instrument-id-e","errorCode":null,"errorMessage":"Failed to decode instrument {instrument_id}: {e}","messagePattern":"Failed to decode instrument (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/databento/src/historical.rs","lineNumber":329,"sourceCode":"                &record,\n                &mut metadata_cache,\n                &self.publisher_venue_map,\n                &sym_map,\n            )?;\n\n            if self.use_exchange_as_venue && instrument_id.venue == Venue::GLBX() {\n                let exchange = msg\n                    .exchange()\n                    .map_err(|e| anyhow::anyhow!(\"Missing exchange in record: {e}\"))?;\n                let venue = Venue::from_code(exchange)\n                    .map_err(|e| anyhow::anyhow!(\"Venue not found for exchange {exchange}: {e}\"))?;\n                instrument_id.venue = venue;\n            }\n\n            match decode_instrument_def_msg(msg, instrument_id, None, None) {\n                Ok(Some(instrument)) => instruments.push(instrument),\n                Ok(None) => {} // Decoder logged a warning for the unsupported class\n                Err(e) => anyhow::bail!(\"Failed to decode instrument {instrument_id}: {e}\"),\n            }\n        }\n\n        for instrument in &instruments {\n            self.price_precisions\n                .insert(instrument.id().symbol, instrument.price_precision());\n        }\n\n        Ok(instruments)\n    }\n\n    /// Fetches quote ticks for the given parameters.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the API request or data processing fails.\n    pub async fn get_range_quotes(\n        &self,","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/databento/src/historical.rs#L311-L347","documentation":"`get_range_instruments` (used by `seed_price_precision_if_needed`) fetches instrument definitions from Databento and decodes each into a Nautilus `InstrumentDef`. When `decode_instrument_def_msg` fails for a specific instrument, the error is wrapped with the instrument_id and propagated, aborting the whole definitions request rather than skipping the instrument.","triggerScenarios":"Calling a historical data range method that needs price precision seeding, where one of the returned definition records fails to decode (e.g. undefined required price/timestamp/multiplier, or unsupported instrument class returning Err).","commonSituations":"Requesting data for a symbol batch where a single broken/unusual definition poisons the entire call; asset classes whose definition fields don't match the decoder's expectations; Databento schema changes.","solutions":["Read the wrapped inner error and instrument_id to identify the failing record; request that definition alone to inspect it.","Remove or pre-validate the offending symbol from the request.","If the instrument class is unsupported, ensure the decoder is expected to skip (Ok(None)) — check which check returned Err instead.","Wrap the seeding call so a failing instrument can be skipped instead of failing the whole data request."],"exampleFix":"// before\nmatch decode_instrument_def_msg(msg, instrument_id, None, None)? { ... }\n// after\nmatch decode_instrument_def_msg(msg, instrument_id, None, None) {\n    Ok(Some(i)) => instruments.push(i),\n    Ok(None) => {}\n    Err(e) => { log::warn!(\"skipping {instrument_id}: {e}\"); continue; }\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match get_range_instruments(...).await {\n    Ok(defs) => defs,\n    Err(e) => {\n        // e contains \"Failed to decode instrument <id>: <cause>\"\n        let id = extract_instrument_id(&e.to_string());\n        log::warn!(\"skipping undecodable instrument {id}: {e}\");\n        Vec::new()\n    }\n}","preventionTips":["Request definitions for symbols individually or in small batches so one bad record doesn't poison the batch.","Keep the adapter and dbn crate versions in sync.","Log the full anyhow chain to see the inner decode cause."],"tags":["databento","instrument-definitions","decode","error-wrapping"],"backgroundTag":"api-error-response","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"}