{"record":{"id":"63472ea6f2afae13","repo":"nautechsystems/nautilus_trader","slug":"invalid-schema-param-schema-must-be-one-o","errorCode":null,"errorMessage":"Invalid `{SCHEMA_PARAM}` '{schema}'. Must be one of: {allowed}","messagePattern":"Invalid `(.+?)` '(.+?)'\\. Must be one of: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/databento/src/data.rs","lineNumber":1431,"sourceCode":"    default_schema: dbn::Schema,\n    allowed_schemas: &[dbn::Schema],\n) -> anyhow::Result<dbn::Schema> {\n    let schema = if let Some(schema) = params.and_then(|params| params.get_str(SCHEMA_PARAM)) {\n        dbn::Schema::from_str(schema)?\n    } else {\n        default_schema\n    };\n\n    if allowed_schemas.contains(&schema) {\n        return Ok(schema);\n    }\n\n    let allowed = allowed_schemas\n        .iter()\n        .map(dbn::Schema::as_str)\n        .collect::<Vec<_>>()\n        .join(\", \");\n    anyhow::bail!(\n        \"Invalid `{SCHEMA_PARAM}` '{}'. Must be one of: {allowed}\",\n        schema.as_str()\n    );\n}\n\nfn send_subscription_commands(\n    tx: &tokio::sync::mpsc::UnboundedSender<HandlerCommand>,\n    dataset: &str,\n    price_precision: Option<(Symbol, u8)>,\n    subscription: Subscription,\n    start_after_subscribe: bool,\n) -> anyhow::Result<()> {\n    if let Some((symbol, precision)) = price_precision {\n        tx.send(HandlerCommand::SetPricePrecision(symbol, precision))\n            .map_err(|e| anyhow::anyhow!(\"Failed to send command to dataset {dataset}: {e}\"))?;\n    }\n\n    tx.send(HandlerCommand::Subscribe(subscription))","sourceCodeStart":1413,"sourceCodeEnd":1449,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/databento/src/data.rs#L1413-L1449","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nsubscribe_quotes(schema=\"mbp-1\", ...) // if mbp-1 is not in allowed set\n// after\nsubscribe_quotes(schema=\"trades\", ...) // one of the allowed schemas","handlingStrategy":"validation","validationCode":"const ALLOWED_SCHEMAS: &[&str] = &[\"mbo\", \"mbp-1\", \"mbp-10\", \"trades\", \"tbbo\", \"cbbo\"]; // match the adapter's list\nfn validate_schema(schema: &str) -> Result<(), String> {\n    ALLOWED_SCHEMAS.contains(&schema).then(|| ()).ok_or_else(|| format!(\"unsupported schema: {schema}\"))\n}","typeGuard":"fn is_allowed_schema(schema: &str) -> bool { ALLOWED_SCHEMAS.contains(&schema) }","tryCatchPattern":"match subscribe_quotes(schema) {\n    Ok(sub) => sub,\n    Err(e) if e.to_string().contains(\"Must be one of\") => { /* use default schema or corrected value */ }\n    Err(e) => return Err(e),\n}","preventionTips":["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"],"tags":["rust","databento","configuration","schema"],"backgroundTag":"invalid-enum-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}