{"record":{"id":"359db0f9d36209a9","repo":"nautechsystems/nautilus_trader","slug":"venue-not-found-for-exchange-exchange-e","errorCode":null,"errorMessage":"Venue not found for exchange {exchange}: {e}","messagePattern":"Venue not found for exchange (.+?): (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/databento/src/historical.rs","lineNumber":322,"sourceCode":"        let mut metadata_cache = MetadataCache::new(metadata);\n        let mut instruments = Vec::new();\n\n        while let Some(msg) = decoder.decode_record::<dbn::InstrumentDefMsg>().await? {\n            let record = dbn::RecordRef::from(msg);\n            let sym_map = self.symbol_venue_map.load();\n            let mut instrument_id = decode_nautilus_instrument_id(\n                &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","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/databento/src/historical.rs#L304-L340","documentation":"After reading the exchange code from a GLBX instrument definition record (with `use_exchange_as_venue = true`), the adapter maps it to a Nautilus `Venue` via `Venue::from_code`. If no venue is registered for that exchange code, this error reports the unknown code and the underlying lookup error.","triggerScenarios":"`get_range_instruments` encounters a record whose exchange code has no corresponding Nautilus Venue mapping (e.g. a new or unsupported exchange code, or a lowercase/unexpected code string).","commonSituations":"New CME exchanges not yet mapped in the installed nautilus version; custom/fictional exchanges in test data; dataset mixing exchanges outside the GLBX mappings.","solutions":["Update nautilus_trader (and its exchange-code mappings) to a version that includes the venue","Disable `use_exchange_as_venue` so records keep the generic GLBX venue instead of per-exchange venues","Register/add the venue mapping for the specific exchange code if extending the adapter","Log the failing exchange code and check Databento docs for its canonical code"],"exampleFix":"// before\nlet client = DatabentoHistoricalClient::new(cred, path, clock, true)?;\n// after\n// keep use_exchange_as_venue only if all exchange codes are mapped in your nautilus version\nlet client = DatabentoHistoricalClient::new(cred, path, clock, false)?;","handlingStrategy":"try-catch","validationCode":"// check mapping coverage before enabling per-exchange venues\nlet use_exchange_as_venue = all_exchanges_known_to_nautilus();","typeGuard":"fn venue_exists(code: &str) -> bool { Venue::from_code(code).is_ok() }","tryCatchPattern":"let venue = Venue::from_code(exchange)\n    .map_err(|e| { log::warn!(\"unknown exchange {exchange}: {e}; falling back to GLBX\"); Venue::GLBX() });","preventionTips":["Upgrade nautilus_trader to pick up new venue mappings before using new datasets","Only enable use_exchange_as_venue when all expected exchange codes are mapped","Log unknown exchange codes and fall back to GLBX where acceptable","Report/extend mappings for exchanges your strategy requires"],"tags":["rust","databento","venue-mapping","instrument-definitions"],"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-14T05:17:10.506Z"}