nautechsystems/nautilus_trader · error
Error decoding `raw_symbol`: {e}
Error message
Error decoding `raw_symbol`: {e} What it means
After successfully locating an InstrumentDefMsg, the adapter reads the record's `raw_symbol` field; if those bytes cannot be decoded into a valid string (bad UTF-8 or invalid length prefix), decoding fails and the definition is rejected with this error.
Source
Thrown at crates/adapters/databento/src/loader.rs:272
loop {
let advance = dbn_stream
.advance()
.map_err(|e| anyhow::anyhow!("Stream advance error: {e}"));
if let Err(e) = advance {
return Some(Err(e));
}
let rec = dbn_stream.get()?;
let result: anyhow::Result<Option<InstrumentAny>> = (|| {
let record = dbn::RecordRef::from(rec);
let msg = record
.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
}
_ => *selfView on GitHub (pinned to 18893faf8b)
Solutions
- Re-download the definition data from Databento and confirm the file's integrity before loading
- Align the `databento-dbn` dependency version with the file's DBN version (upgrade the adapter and rebuild)
- Validate the file with Databento's dbn tooling to confirm whether corruption is in the data or the adapter
- Skip and log the offending record instead of failing the whole load if only isolated records are bad
Defensive patterns
Strategy: try-catch
Try / catch
for rec in loader.read_definition_records(&path, true, None)? {
match rec {
Ok(inst) => { /* use inst */ }
Err(e) if e.to_string().contains("Error decoding `raw_symbol`") => {
log::warn!("bad record skipped: {e}");
}
Err(e) => return Err(e),
}
} Prevention
- Verify definition file integrity before loading
- Use a databento-dbn version matching the file's DBN version
- Treat isolated decode failures as data corruption; re-download the file
When it happens
Trigger: During load_instruments/read_definition_records, a definition record contains a raw_symbol byte field that fails dbn decoding — corrupt file data, truncated record, or decoder/version layout mismatch.
Common situations: Corrupted or partially written DBN definition files, historical files decoded with an incompatible dbn crate version, custom tooling that rewrote records.
Related errors
- Error decoding `stype_in_symbol`: {e}
- Error decoding `stype_out_symbol`: {e}
- DBN message type is not currently supported
- Invalid data element not `TradeTick`, was {data:?}
- Invalid data element not `Bar`, was {data:?}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/ceed7c8bb55871f8.
Report an issue: GitHub.