{"record":{"id":"3bc285a9087f1efd","repo":"nautechsystems/nautilus_trader","slug":"invalid-data-element-not-quotetick-was-data","errorCode":null,"errorMessage":"Invalid data element not `QuoteTick`, was {data:?}","messagePattern":"Invalid data element not `QuoteTick`, was (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/databento/src/historical.rs","lineNumber":427,"sourceCode":"            let price_precision = self.resolve_cached_price_precision(\n                &instrument_id,\n                price_precision_arg,\n                &mut precision_cache,\n            )?;\n\n            let (data, _) = decode_record(\n                &record,\n                instrument_id,\n                price_precision,\n                None,\n                false, // Don't include trades\n                true,\n            )?;\n\n            match data {\n                Some(Data::Quote(quote)) => result.push(quote),\n                None => {} // Skip records with undefined bid/ask prices\n                _ => anyhow::bail!(\"Invalid data element not `QuoteTick`, was {data:?}\"),\n            }\n            Ok(())\n        };\n\n        match dbn_schema {\n            dbn::Schema::Mbp1 => {\n                while let Some(msg) = decoder.decode_record::<dbn::Mbp1Msg>().await? {\n                    process_record(dbn::RecordRef::from(msg))?;\n                }\n            }\n            dbn::Schema::Tbbo => {\n                while let Some(msg) = decoder.decode_record::<dbn::TbboMsg>().await? {\n                    process_record(dbn::RecordRef::from(msg))?;\n                }\n            }\n            dbn::Schema::Cmbp1 => {\n                while let Some(msg) = decoder.decode_record::<dbn::Cmbp1Msg>().await? {\n                    process_record(dbn::RecordRef::from(msg))?;","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/databento/src/historical.rs#L409-L445","documentation":"Inside `get_range_quotes`, each decoded record is mapped to `Data::Quote(quote)` or `None` (undefined bid/ask, skipped). Any other `Data` variant means the schema produced a record type that is not a quote tick, which is an invariant violation for this method, so it errors with the debug representation of the offending element.","triggerScenarios":"A record from a quote-capable schema decodes into a non-quote `Data` variant — e.g. cmbp-1/tcbbo streams yielding trade-implied records that map to a non-Quote variant, or an internal decode mismatch between the schema allow-list and `process_record`'s conversion.","commonSituations":"Mixed/multi-asset responses where some records are not quotes; adapter bug after a schema allow-list change; feeding cbbo/cmbp schemas whose records decode to trade ticks under certain conditions.","solutions":["Check the printed `data:?` variant to see which record type leaked in; adjust the requested schema to one that yields only quotes.","If the schema legitimately emits non-quote records, handle that variant explicitly instead of erroring.","Upgrade/patch the adapter if this is a decode mismatch bug between schema handling and `Data` conversion.","Filter records client-side: if you control record iteration, skip known non-quote record types before conversion."],"exampleFix":"// before\n_ => anyhow::bail!(\"Invalid data element not `QuoteTick`, was {data:?}\"),\n// after\n_ => { log::debug!(\"skipping non-quote element {data:?}\"); Ok(()) }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn is_quote(data: &Data) -> Option<&QuoteTick> { match data { Data::Quote(q) => Some(q), _ => None } }","tryCatchPattern":"match get_range_quotes(params).await {\n    Ok(quotes) => quotes,\n    Err(e) if e.to_string().contains(\"Invalid data element not `QuoteTick`\") => {\n        log::error!(\"non-quote record leaked: {e}\"); Vec::new()\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Keep the requested schema restricted to pure quote-producing schemas.","Check the debug output in the message to identify which Data variant leaked.","Report persistent occurrences as an adapter bug."],"tags":["databento","decode","quote-tick","invariant"],"backgroundTag":"unexpected-response-shape","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"}