nautechsystems/nautilus_trader · error
Invalid schema {dbn_schema}
Error message
Invalid schema {dbn_schema} What it means
`get_range_quotes` dispatches record decoding per schema (mbp-1, tbbo/tcbbo, bbo, cmbp-1, cbbo). The catch-all arm bails when a schema slipped past the earlier validation but has no decode branch — a defensive internal invariant guard indicating the two schema checks in the method are out of sync.
Source
Thrown at crates/adapters/databento/src/historical.rs:468
process_record(dbn::RecordRef::from(msg))?;
}
}
dbn::Schema::Bbo1M => {
while let Some(msg) = decoder.decode_record::<dbn::Bbo1MMsg>().await? {
process_record(dbn::RecordRef::from(msg))?;
}
}
dbn::Schema::Bbo1S => {
while let Some(msg) = decoder.decode_record::<dbn::Bbo1SMsg>().await? {
process_record(dbn::RecordRef::from(msg))?;
}
}
dbn::Schema::Cbbo1S | dbn::Schema::Cbbo1M => {
while let Some(msg) = decoder.decode_record::<dbn::CbboMsg>().await? {
process_record(dbn::RecordRef::from(msg))?;
}
}
_ => anyhow::bail!("Invalid schema {dbn_schema}"),
}
Ok(result)
}
/// Fetches order book depth10 snapshots for the given parameters.
///
/// # Errors
///
/// Returns an error if the API request or data processing fails.
pub async fn get_range_order_book_depth10(
&self,
params: RangeQueryParams,
depth: Option<usize>,
) -> anyhow::Result<Vec<OrderBookDepth10>> {
let symbols: Vec<&str> = params.symbols.iter().map(String::as_str).collect();
check_consistent_symbology(&symbols)?;
View on GitHub (pinned to 18893faf8b)
Solutions
- Check the adapter version against the dbn crate version and upgrade the adapter so validation and dispatch match.
- Report/fix the mismatch: add the schema to the decode match or remove it from the allow-list.
- Use only long-standing schemas (mbp-1, tbbo, bbo-1s/1m, cmbp-1, tcbbo, cbbo-1s/1m) until the adapter is fixed.
Example fix
// before
_ => anyhow::bail!("Invalid schema {dbn_schema}"),
// after
_ => anyhow::bail!("Schema {dbn_schema} passed validation but has no decode handler; this is an adapter bug"), Defensive patterns
Strategy: try-catch
Try / catch
let quotes = get_range_quotes(params).await.unwrap_or_else(|e| {
assert!(!e.to_string().contains("Invalid schema"), "adapter bug: {e}");
Vec::new()
}); Prevention
- Use only well-established schemas (mbp-1, tbbo, bbo-1s/1m, cmbp-1, tcbbo, cbbo-1s/1m).
- Keep adapter and dbn crate versions aligned; this arm indicates internal divergence.
- Treat this error as a bug report trigger, not a user-input problem.
When it happens
Trigger: A `dbn::Schema` value that passed the allow-list check at the top of `get_range_quotes` but reaches the final `_ =>` arm of the per-schema decode match — normally impossible unless the two match arms diverge after an adapter update.
Common situations: Running a newer Databento dbn crate where new schema variants exist; a code change that added a schema to the validation allow-list but not to the decode dispatch; stale adapter version.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Invalid schema. Must be one of: mbp-1, tbbo, bbo-1s, bbo-1m,
- Invalid schema. Must be one of: trades, tbbo, tcbbo, mbp-1,
- Invalid `{SCHEMA_PARAM}` '{schema}'. Must be one of: {allowe
- DBN message type is not currently supported
- Failed to create client builder: {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/754c0355ca940df7.
Report an issue: GitHub.