nautechsystems/nautilus_trader · error
Venue not found for exchange {exchange}: {e}
Error message
Venue not found for exchange {exchange}: {e} What it means
After extracting the exchange code for a GLBX.MDP3 record, the loader converts it to a Nautilus `Venue` via `Venue::from_code`. If that exchange code is not a known venue the conversion error is re-raised with the exchange value embedded.
Source
Thrown at crates/adapters/databento/src/loader.rs:285
.get::<InstrumentDefMsg>()
.ok_or_else(|| anyhow::anyhow!("Failed to decode InstrumentDefMsg"))?;
let raw_symbol = rec
.raw_symbol()
.map_err(|e| anyhow::anyhow!("Error decoding `raw_symbol`: {e}"))?;
let symbol = Symbol::from(raw_symbol);
let publisher = rec
.hd
.publisher()
.map_err(|e| anyhow::anyhow!("Invalid `publisher` for record: {e}"))?;
let venue = match publisher {
Publisher::GlbxMdp3Glbx if use_exchange_as_venue => {
let exchange = rec.exchange().map_err(|e| {
anyhow::anyhow!("Missing `exchange` for record: {e}")
})?;
let venue = Venue::from_code(exchange).map_err(|e| {
anyhow::anyhow!("Venue not found for exchange {exchange}: {e}")
})?;
self.symbol_venue_map.insert(symbol, venue);
venue
}
_ => *self
.publisher_venue_map
.get(&msg.hd.publisher_id)
.ok_or_else(|| {
anyhow::anyhow!(
"Venue not found for publisher_id {}",
msg.hd.publisher_id
)
})?,
};
let instrument_id = InstrumentId::new(symbol, venue);
let ts_init = msg.ts_recv.into();
decode_instrument_def_msg(rec, instrument_id, Some(ts_init), decode_config)View on GitHub (pinned to 18893faf8b)
Solutions
- Upgrade NautilusTrader to a version whose venue registry knows the exchange code
- Check the error's embedded exchange string and register/patch the venue mapping if running a custom build
- Pass `use_exchange_as_venue = false` to use the publisher-based venue mapping instead
- Confirm the dataset is GLBX; if the data is from another dataset the exchange codes may be foreign
Example fix
// before
let venue = Venue::from_code(exchange).map_err(|e| anyhow::anyhow!("Venue not found for exchange {exchange}: {e}"))?;
// after
let venue = Venue::from_code(exchange).unwrap_or_else(|_| Venue::from_code("GLBX")); // graceful fallback to canonical GLBX venue Defensive patterns
Strategy: fallback
Validate before calling
// pre-check that every exchange code you expect is a known venue
for code in expected_exchange_codes {
assert!(Venue::from_code(code).is_ok(), "unknown venue code: {code}");
} Try / catch
let venue = Venue::from_code(exchange).unwrap_or(VENUE_GLBX); // or map to a default venue on failure
Prevention
- Keep NautilusTrader updated so new exchange codes are registered
- Check Databento release notes for new GLBX exchange codes before ingesting
- Fall back to publisher-based venue mapping for unfamiliar exchanges
When it happens
Trigger: GLBX.MDP3 definition records whose exchange code (e.g. a new or unusual CME group exchange) has no corresponding registered `Venue` in the loader's `Venue::from_code` mapping.
Common situations: Databento adds a new exchange code after the installed nautilus version was released; loading data from an exotic market within GLBX that the venue registry does not cover.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Venue not found for exchange {exchange}: {e}
- Venue not found for publisher_id {}
- Unsupported `OrderSide` for Binance: {value:?}
- Unsupported OrderType for conditional orders: {value:?}
- Invalid `OrderType` cannot be represented on OKX: {value:?}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/35fdfae4a5896a00.
Report an issue: GitHub.