{"record":{"id":"48508a835a7b18e8","repo":"nautechsystems/nautilus_trader","slug":"unsupported-bar-aggregation-type-suffix","errorCode":null,"errorMessage":"Unsupported bar aggregation type: '{suffix}'","messagePattern":"Unsupported bar aggregation type: '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/tardis/src/common/parse.rs","lineNumber":345,"sourceCode":"        .last()\n        .ok_or_else(|| anyhow::anyhow!(\"Invalid bar spec: empty string\"))?;\n    let split_idx = last_part\n        .chars()\n        .position(|c| !c.is_ascii_digit())\n        .ok_or_else(|| anyhow::anyhow!(\"Invalid bar spec: no aggregation suffix in '{value}'\"))?;\n\n    let (step_str, suffix) = last_part.split_at(split_idx);\n    let step: usize = step_str\n        .parse()\n        .map_err(|e| anyhow::anyhow!(\"Invalid step in bar spec '{value}': {e}\"))?;\n\n    let aggregation = match suffix {\n        \"ms\" => BarAggregation::Millisecond,\n        \"s\" => BarAggregation::Second,\n        \"m\" => BarAggregation::Minute,\n        \"ticks\" => BarAggregation::Tick,\n        \"vol\" => BarAggregation::Volume,\n        _ => anyhow::bail!(\"Unsupported bar aggregation type: '{suffix}'\"),\n    };\n\n    parse_canonical_bar_spec(step, aggregation)\n        .with_context(|| format!(\"Invalid bar spec '{value}'\"))\n}\n\nfn parse_canonical_bar_spec(\n    step: usize,\n    aggregation: BarAggregation,\n) -> anyhow::Result<BarSpecification> {\n    match aggregation {\n        BarAggregation::Millisecond if step.is_multiple_of(1000) => {\n            parse_canonical_bar_spec(step / 1000, BarAggregation::Second)\n        }\n        BarAggregation::Second if step.is_multiple_of(60) => {\n            parse_canonical_bar_spec(step / 60, BarAggregation::Minute)\n        }\n        BarAggregation::Minute if step.is_multiple_of(60) => {","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/tardis/src/common/parse.rs#L327-L363","documentation":"parse_bar_spec converts Tardis bar spec strings like '1m', '100ticks', '5vol' into BarAggregation values. The suffix after the numeric step must be one of ms/s/m/ticks/vol; any other suffix triggers this bail, wrapped with 'Invalid bar spec' context.","triggerScenarios":"Calling parse_bar_spec (or parse_bar_msg) with a bar spec string whose aggregation suffix is not one of ms, s, m, ticks, vol — e.g. '1h', '5d', '10count' or a malformed spec like 'm1'.","commonSituations":"Tardis dataset uses an aggregation NautilusTrader does not map (hourly/daily bars); typos in bar spec strings in config; passing Tardis-specific strings that use unsupported units.","solutions":["Use only supported suffixes: ms, s, m, ticks, vol (e.g. '1m', '60s', '100ticks', '5vol')","Convert unsupported aggregations (hour/day) yourself into supported units, e.g. 1h -> 60m","Check the input string for typos or swapped order (step must come first: '5m', not 'm5')","If hourly/daily Tardis bars are needed, request support or aggregate upstream data manually"],"exampleFix":"// before\nlet spec = parse_bar_spec(\"1h\")?; // bail: Unsupported bar aggregation type: 'h'\n// after\nlet spec = parse_bar_spec(\"60m\")?; // equivalent, supported suffix","handlingStrategy":"validation","validationCode":"fn is_supported_bar_spec(spec: &str) -> bool {\n    let suffix = spec.trim_start_matches(|c: char| c.is_ascii_digit());\n    matches!(suffix, \"ms\" | \"s\" | \"m\" | \"ticks\" | \"vol\")\n}\n// call before parse_bar_spec\nassert!(is_supported_bar_spec(\"60m\"));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate bar spec strings against the allowed suffix set ms/s/m/ticks/vol before parsing","Express hourly/daily intervals in minutes/seconds (60m, 1440m) rather than h/d","Centralize bar spec definitions in config constants to avoid typos"],"tags":["tardis","parsing","bars","configuration"],"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"}