{"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":1454,"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":1436,"sourceCodeEnd":1472,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/common/parse.rs#L1436-L1472","documentation":"bar_spec_to_binance_interval supports hour steps 1, 2, 4, 6, 8 and 12 — the exact set of Binance hourly kline intervals (1h, 2h, 4h, 6h, 8h, 12h). Other hour steps such as 3h or 24h have no native interval and bail with this message (24h should be expressed as 1-DAY).","triggerScenarios":"Requesting Binance bars with an hour step outside {1, 2, 4, 6, 8, 12} — commonly 3-HOUR or 24-HOUR specifications.","commonSituations":"Configs ported from venues with arbitrary hour klines; sessions defined as 3h blocks; 24-HOUR used where 1-DAY is meant.","solutions":["Remap the step onto a supported interval: 24-HOUR becomes 1-DAY, 3-HOUR becomes 1-HOUR/4-HOUR.","Or use INTERNAL aggregation (e.g. 3-HOUR-LAST-INTERNAL) to keep the exact step locally.","Validate BarType strings in config before startup."],"exampleFix":"// before\n// let bar_type = BarType::from(\"3-HOUR-LAST-EXTERNAL\");\n// -> Unsupported hour interval: 3h\n\n// after\n// let bar_type = BarType::from(\"3-HOUR-LAST-INTERNAL\"); // aggregated locally\n// or\n// let bar_type = BarType::from(\"4-HOUR-LAST-EXTERNAL\"); // nearest venue interval","handlingStrategy":"validation","validationCode":"fn supported_hour_step(step: u32) -> bool {\n    matches!(step, 1 | 2 | 4 | 6 | 8 | 12)\n}","typeGuard":"fn is_supported_hour_bar(step: u32) -> bool {\n    matches!(step, 1 | 2 | 4 | 6 | 8 | 12)\n}","tryCatchPattern":"let bar_type = BarType::from(\"3-HOUR-LAST-EXTERNAL\");\nif let Err(e) = data_client.subscribe_bars(bar_type) {\n    if e.to_string().contains(\"Unsupported hour interval\") {\n        // fall back: 4-HOUR external or 3-HOUR-LAST-INTERNAL\n    } else {\n        return Err(e);\n    }\n}","preventionTips":["Validate hour steps against {1, 2, 4, 6, 8, 12}; express 24h as 1-DAY.","Use INTERNAL aggregation for odd hour steps like 3h.","Unit-test bar spec construction against the supported sets."],"tags":["binance","bars","klines","hour-interval","barspecification","rust"],"backgroundTag":"unsupported-bar-interval","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}