nautechsystems/nautilus_trader · error
Invalid schema. Must be one of: trades, tbbo, tcbbo, mbp-1,
Error message
Invalid schema. Must be one of: trades, tbbo, tcbbo, mbp-1, cmbp-1
What it means
`get_range_trades` only supports trade-producing Databento schemas: trades, tbbo, tcbbo, mbp-1, cmbp-1. Any other schema in the request params triggers this bail before the data request, since other schemas' records cannot be converted to `TradeTick` results.
Source
Thrown at crates/adapters/databento/src/historical.rs:665
let first_symbol = params
.symbols
.first()
.ok_or_else(|| anyhow::anyhow!("No symbols provided"))?;
let stype_in = infer_symbology_type(first_symbol);
let end = params.end.unwrap_or_else(|| self.clock.get_time_ns());
let time_range = get_date_time_range(params.start, end)?;
let schema = schema.unwrap_or_else(|| "trades".to_string());
let dbn_schema = dbn::Schema::from_str(&schema)?;
match dbn_schema {
dbn::Schema::Trades
| dbn::Schema::Tbbo
| dbn::Schema::Tcbbo
| dbn::Schema::Mbp1
| dbn::Schema::Cmbp1 => (),
_ => {
anyhow::bail!("Invalid schema. Must be one of: trades, tbbo, tcbbo, mbp-1, cmbp-1")
}
}
let range_params = GetRangeParams::builder()
.dataset(params.dataset)
.date_time_range(time_range)
.symbols(symbols)
.stype_in(stype_in)
.schema(dbn_schema)
.maybe_limit(params.limit.and_then(NonZeroU64::new))
.build();
let price_precision_arg = params.price_precision;
let mut client = (*self.inner).clone();
let mut decoder = client
.timeseries()
.get_range(&range_params)View on GitHub (pinned to 18893faf8b)
Solutions
- Set `schema` to one of: trades, tbbo, tcbbo, mbp-1, cmbp-1.
- For BBO-style quotes use `get_range_quotes` instead of `get_range_trades`.
- Validate the schema value in your config layer before constructing the request.
- If a new schema is required, extend the adapter's match arm to support it.
Example fix
// before let params = params.schema(dbn::Schema::Bbo1S); historical.get_range_trades(params).await?; // after let params = params.schema(dbn::Schema::Trades); historical.get_range_trades(params).await?;
Defensive patterns
Strategy: validation
Validate before calling
const TRADE_SCHEMAS: &[dbn::Schema] = &[
dbn::Schema::Trades, dbn::Schema::Tbbo, dbn::Schema::Tcbbo,
dbn::Schema::Mbp1, dbn::Schema::Cmbp1,
];
assert!(TRADE_SCHEMAS.contains(&schema), "unsupported trade schema"); Type guard
fn is_trade_schema(s: dbn::Schema) -> bool {
matches!(s, dbn::Schema::Trades | dbn::Schema::Tbbo | dbn::Schema::Tcbbo
| dbn::Schema::Mbp1 | dbn::Schema::Cmbp1)
} Prevention
- Route quote schemas (bbo/cbbo) to get_range_quotes, not get_range_trades.
- Validate schema values from config/CLI against the allow-list before requesting.
- Keep the schema intent (trades vs quotes vs depth) consistent across the request pipeline.
When it happens
Trigger: Calling `get_range_trades` with `params.schema` set to e.g. `bbo-1s`, `ohlcv-1d`, `mbp-10`, or any schema outside the allow-list.
Common situations: Reusing a quotes request's schema (bbo/cbbo) for a trades call; schema strings sourced from config or CLI with a typo or wrong category; new Databento schemas not yet supported.
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
- Invalid schema. Must be one of: mbp-1, tbbo, bbo-1s, bbo-1m,
- Invalid schema {dbn_schema}
- Colors dict missing required keys: {missing_keys}. Required
- Invalid `{SCHEMA_PARAM}` '{schema}'. Must be one of: {allowe
- Invalid negative `contract_multiplier`: {value}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/b8a88a7baf4bc453.
Report an issue: GitHub.