{"record":{"id":"3e26f91f82e3caa6","repo":"nautechsystems/nautilus_trader","slug":"invalid-bar-type-string-bt","errorCode":null,"errorMessage":"Invalid bar type string: '{bt}'","messagePattern":"Invalid bar type string: '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/backtest/src/config.rs","lineNumber":1029,"sourceCode":"    /// # Errors\n    ///\n    /// Returns an error if any bar type string cannot be parsed.\n    pub fn get_instrument_ids(&self) -> anyhow::Result<Vec<InstrumentId>> {\n        if let Some(id) = self.instrument_id {\n            return Ok(vec![id]);\n        }\n\n        if let Some(ids) = &self.instrument_ids {\n            return Ok(ids.clone());\n        }\n\n        if let Some(bar_types) = &self.bar_types {\n            let ids = bar_types\n                .iter()\n                .map(|bt| {\n                    bt.parse::<BarType>()\n                        .map(|b| b.instrument_id())\n                        .map_err(|_| anyhow::anyhow!(\"Invalid bar type string: '{bt}'\"))\n                })\n                .collect::<anyhow::Result<Vec<_>>>()?;\n            return Ok(ids);\n        }\n        Ok(Vec::new())\n    }\n}\n\n/// Represents the configuration for one specific backtest run.\n/// This includes a backtest engine with its actors and strategies, with the external inputs of venues and data.\n#[derive(Debug, Clone, bon::Builder)]\n#[builder(finish_fn(name = build_inner, vis = \"\"))]\n#[cfg_attr(\n    feature = \"python\",\n    pyo3::pyclass(module = \"nautilus_trader.backtest\", from_py_object, unsendable)\n)]\n#[cfg_attr(\n    feature = \"python\",","sourceCodeStart":1011,"sourceCodeEnd":1047,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/backtest/src/config.rs#L1011-L1047","documentation":"BacktestConfig derives instrument IDs from its configured bar_types by parsing each string into a BarType. If any string is not a valid BarType representation, the parse fails and this error reports the offending string. BarType strings must encode instrument id, step, aggregation, and source (e.g. 'EUR/USD.SIM-1-MINUTE-EXTERNAL').","triggerScenarios":"Calling the config method that resolves bar instruments (instrument_ids_for_bars) while self.bar_types contains a string that fails bt.parse::<BarType>() — malformed separators, wrong aggregation keyword, unknown source, or an instrument id that doesn't parse as InstrumentId.","commonSituations":"Hand-written backtest config YAML/JSON with a typo like '1-MIN' instead of '1-MINUTE'; missing the -EXTERNAL suffix; wrong venue/instrument formatting; bar types copied from a different adapter's naming convention.","solutions":["Fix the offending bar_types string to a full BarType format like 'INSTRUMENT.VENUE-<step>-<AGGREGATION>-<SOURCE>' (e.g. 'AAPL.NASDAQ-1-MINUTE-EXTERNAL').","Build bar types programmatically via BarType::new / from components instead of hand-writing strings.","Validate each bar_types entry by parsing it in your config loader and logging the exact parse error for diagnosis."],"exampleFix":"// before\nbar_types = [\"AAPL.NASDAQ-1-MIN\"]\n// after\nbar_types = [\"AAPL.NASDAQ-1-MINUTE-EXTERNAL\"]","handlingStrategy":"validation","validationCode":"// validate bar type strings before building config\nfor bt in &bar_types {\n    if let Err(e) = bt.parse::<BarType>() {\n        return Err(format!(\"invalid bar_types entry '{bt}': {e}\"));\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use BarType::parse in a config preflight step and surface the underlying parse error.","Construct bar types programmatically instead of hand-writing strings.","Keep a documented example of the exact format INSTRUMENT.VENUE-step-AGGREGATION-SOURCE."],"tags":["rust","backtest","config","bars","parsing"],"backgroundTag":"invalid-argument-format","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"}