nautechsystems/nautilus_trader · error
Invalid `{SCHEMA_PARAM}` '{schema}'. Must be one of: {allowe
Error message
Invalid `{SCHEMA_PARAM}` '{schema}'. Must be one of: {allowed} What it means
This error is raised by `schema_from_params` when the user-supplied Databento schema parameter (e.g. `schema=mbo`) is not one of the schemas the adapter explicitly supports for subscriptions/requests. The library builds the list of allowed `dbn::Schema` values and fails fast instead of sending an unsupported schema to Databento.
Source
Thrown at crates/adapters/databento/src/data.rs:1431
default_schema: dbn::Schema,
allowed_schemas: &[dbn::Schema],
) -> anyhow::Result<dbn::Schema> {
let schema = if let Some(schema) = params.and_then(|params| params.get_str(SCHEMA_PARAM)) {
dbn::Schema::from_str(schema)?
} else {
default_schema
};
if allowed_schemas.contains(&schema) {
return Ok(schema);
}
let allowed = allowed_schemas
.iter()
.map(dbn::Schema::as_str)
.collect::<Vec<_>>()
.join(", ");
anyhow::bail!(
"Invalid `{SCHEMA_PARAM}` '{}'. Must be one of: {allowed}",
schema.as_str()
);
}
fn send_subscription_commands(
tx: &tokio::sync::mpsc::UnboundedSender<HandlerCommand>,
dataset: &str,
price_precision: Option<(Symbol, u8)>,
subscription: Subscription,
start_after_subscribe: bool,
) -> anyhow::Result<()> {
if let Some((symbol, precision)) = price_precision {
tx.send(HandlerCommand::SetPricePrecision(symbol, precision))
.map_err(|e| anyhow::anyhow!("Failed to send command to dataset {dataset}: {e}"))?;
}
tx.send(HandlerCommand::Subscribe(subscription))View on GitHub (pinned to 18893faf8b)
Solutions
- Check the message's 'Must be one of:' list and use exactly one of those schema strings
- Use the `dbn::Schema::as_str` canonical name rather than a hand-written string
- Upgrade the adapter crate if a newly added Databento schema is needed
- For tests, pass an explicitly allowed value or rely on the default path
Example fix
// before subscribe_quotes(schema="mbp-1", ...) // if mbp-1 is not in allowed set // after subscribe_quotes(schema="trades", ...) // one of the allowed schemas
Defensive patterns
Strategy: validation
Validate before calling
const ALLOWED_SCHEMAS: &[&str] = &["mbo", "mbp-1", "mbp-10", "trades", "tbbo", "cbbo"]; // match the adapter's list
fn validate_schema(schema: &str) -> Result<(), String> {
ALLOWED_SCHEMAS.contains(&schema).then(|| ()).ok_or_else(|| format!("unsupported schema: {schema}"))
} Type guard
fn is_allowed_schema(schema: &str) -> bool { ALLOWED_SCHEMAS.contains(&schema) } Try / catch
match subscribe_quotes(schema) {
Ok(sub) => sub,
Err(e) if e.to_string().contains("Must be one of") => { /* use default schema or corrected value */ }
Err(e) => return Err(e),
} Prevention
- Copy schema strings from the adapter's allowed list, not from memory
- Use the dbn::Schema enum's as_str output for canonical names
- Add a startup config validation step for all schema parameters
- Keep the adapter and dbn crate versions in sync
When it happens
Trigger: Calling `subscribe_quotes`, `subscribe_trades`, `request_quotes`, or `request_trades` with a `schema` parameter value that is misspelled, not in the allowed set, or omitted when no default can be derived.
Common situations: Typo in the schema name (e.g. `mbp_10` vs `mbp-10`), copying a schema string from Databento docs that the adapter has not whitelisted, or passing a schema valid for the Databento API but unsupported by the adapter version.
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
- Failed to parse Databento Historical API base URL: {e}
- Unsupported blockchain {blockchain} for RPC connection
- Kraken Spot does not support the demo environment
- Redis config error: username supplied without password. Eith
- {secret_var} is required when {key_var} is provided
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/63472ea6f2afae13.
Report an issue: GitHub.