{"record":{"id":"deb44fc8d4b2e952","repo":"nautechsystems/nautilus_trader","slug":"invalid-data-element-not-bar-was-data","errorCode":null,"errorMessage":"Invalid data element not `Bar`, was {data:?}","messagePattern":"Invalid data element not `Bar`, was (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/databento/src/historical.rs","lineNumber":835,"sourceCode":"                &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, // Not applicable\n                timestamp_on_close,\n            )?;\n\n            match data {\n                Some(Data::Bar(bar)) => {\n                    result.push(bar);\n                }\n                _ => anyhow::bail!(\"Invalid data element not `Bar`, was {data:?}\"),\n            }\n        }\n\n        Ok(result)\n    }\n\n    /// Fetches imbalance data for the given parameters.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the API request or data processing fails.\n    pub async fn get_range_imbalance(\n        &self,\n        params: RangeQueryParams,\n    ) -> anyhow::Result<Vec<DatabentoImbalance>> {\n        let symbols: Vec<&str> = params.symbols.iter().map(String::as_str).collect();\n        check_consistent_symbology(&symbols)?;\n","sourceCodeStart":817,"sourceCodeEnd":853,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/databento/src/historical.rs#L817-L853","documentation":"In `get_range_bars`, each decoded record must decode to `Some(Data::Bar)`. If decoding yields `None` or any non-bar `Data` variant, the match falls to the catch-all arm and bails. This means the record stream for a bar request did not contain bar data.","triggerScenarios":"Calling `get_range_bars` when the resolved schema is not an OHLCV schema, or the record fails to decode into a bar (e.g. a trade/quote record reaching the bar decode path, or None from decode_record).","commonSituations":"Schema/aggregation mismatch causing trade records to enter the bar pipeline; datasets or record types unsupported by the decoder; Databento SDK version change altering record decoding.","solutions":["Verify the aggregation maps to the intended OHLCV schema (Ohlcv1S/1M/1H/1D).","Inspect the `{data:?}` value in the message to see what was actually decoded.","Ensure the dataset/publisher actually serves OHLCV data for the requested instrument.","Align the databento-rs DBN version with the one this adapter was built against."],"exampleFix":"// before\n// schema resolved to trades but called get_range_bars\nlet bars = client.get_range_bars(&params, BarAggregation::Minute)?;\n// after\nparams.schema = Some(\"ohlcv-1m\");\nlet bars = client.get_range_bars(&params, BarAggregation::Minute)?;","handlingStrategy":"validation","validationCode":"// Ensure the request is actually a bar request before decoding\nassert params.schema.startswith(\"ohlcv\"), f\"bar fetch requires ohlcv schema, got {params.schema}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Match the schema to the aggregation mapping (Ohlcv1S/1M/1H/1D)","Do not reuse a trade/quote request's params for bar fetching","Verify dataset serves OHLCV for the requested symbols"],"tags":["databento","decoding","bar","schema-mismatch"],"backgroundTag":"incompatible-source-type","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"}