{"record":{"id":"76afac300d9b74c7","repo":"nautechsystems/nautilus_trader","slug":"unsupported-hour-interval-step-h","errorCode":null,"errorMessage":"Unsupported hour interval: {step}h","messagePattern":"Unsupported hour interval: (.+?)h","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/common/parse.rs","lineNumber":1448,"sourceCode":"            1 => BinanceKlineInterval::Second1,\n            _ => anyhow::bail!(\"Unsupported second interval: {step}s\"),\n        },\n        BarAggregation::Minute => match step {\n            1 => BinanceKlineInterval::Minute1,\n            3 => BinanceKlineInterval::Minute3,\n            5 => BinanceKlineInterval::Minute5,\n            15 => BinanceKlineInterval::Minute15,\n            30 => BinanceKlineInterval::Minute30,\n            _ => anyhow::bail!(\"Unsupported minute interval: {step}m\"),\n        },\n        BarAggregation::Hour => match step {\n            1 => BinanceKlineInterval::Hour1,\n            2 => BinanceKlineInterval::Hour2,\n            4 => BinanceKlineInterval::Hour4,\n            6 => BinanceKlineInterval::Hour6,\n            8 => BinanceKlineInterval::Hour8,\n            12 => BinanceKlineInterval::Hour12,\n            _ => anyhow::bail!(\"Unsupported hour interval: {step}h\"),\n        },\n        BarAggregation::Day => match step {\n            1 => BinanceKlineInterval::Day1,\n            3 => BinanceKlineInterval::Day3,\n            _ => anyhow::bail!(\"Unsupported day interval: {step}d\"),\n        },\n        BarAggregation::Week => match step {\n            1 => BinanceKlineInterval::Week1,\n            _ => anyhow::bail!(\"Unsupported week interval: {step}w\"),\n        },\n        BarAggregation::Month => match step {\n            1 => BinanceKlineInterval::Month1,\n            _ => anyhow::bail!(\"Unsupported month interval: {step}M\"),\n        },\n        agg => anyhow::bail!(\"Unsupported bar aggregation for Binance: {agg:?}\"),\n    };\n\n    Ok(interval)","sourceCodeStart":1430,"sourceCodeEnd":1466,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/common/parse.rs#L1430-L1466","documentation":"bar_spec_to_binance_interval converts a Nautilus BarAggregation/step pair into a Binance kline interval. Binance only supports specific hour klines (1h, 2h, 4h, 6h, 8h, 12h), so an hour-aggregated bar spec with any other step cannot be mapped and the function bails with this error before subscribing.","triggerScenarios":"Calling subscribe_bars or unsubscribe_bars with a BarAggregation::Hour step not in {1,2,4,6,8,12}, e.g. a 3-HOUR or 5-HOUR bar spec on a Binance data client.","commonSituations":"Configuring a custom 3h or 5h bar aggregation in a strategy config and assuming Binance supports arbitrary hour steps; migrating from another venue whose API supports arbitrary intervals.","solutions":["Change the bar spec step to one of 1, 2, 4, 6, 8, or 12 hours","Aggregate internally: request a supported interval (e.g. 1h) and build 3h bars via internal aggregation if needed","If you own the parse code, extend the match arms only if Binance adds new kline intervals"],"exampleFix":"// before\nBarSpec::new(instrument_id, BAR_SPEC_3_HOUR, PriceType::Last)\n// after\nBarSpec::new(instrument_id, BAR_SPEC_4_HOUR, PriceType::Last)","handlingStrategy":"validation","validationCode":"const SUPPORTED_HOURS: [u64; 6] = [1, 2, 4, 6, 8, 12];\nfn is_supported_hour_step(step: u64) -> bool { SUPPORTED_HOURS.contains(&step) }\nif !is_supported_hour_step(bar_spec.aggregation_step) { /* fix spec before subscribe_bars */ }","typeGuard":"fn is_supported_hour_step(step: u64) -> bool { matches!(step, 1 | 2 | 4 | 6 | 8 | 12) }","tryCatchPattern":"match client.subscribe_bars(bar_spec) {\n    Err(e) if e.to_string().contains(\"Unsupported hour interval\") => {\n        log::warn!(\"falling back to 1h bars with internal aggregation\");\n    }\n    r => r?,\n}","preventionTips":["Keep a constants list of Binance-supported kline steps next to your strategy configs","Unit-test your bar specs against bar_spec_to_binance_interval before live runs","Never assume interval parity with other venues"],"tags":["rust","binance","bar-aggregation","config"],"backgroundTag":"unsupported-enum-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}