{"record":{"id":"c4fe28a20714dd5e","repo":"nautechsystems/nautilus_trader","slug":"unsupported-second-interval-step-s","errorCode":null,"errorMessage":"Unsupported second interval: {step}s","messagePattern":"Unsupported second interval: (.+?)s","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/common/parse.rs","lineNumber":1437,"sourceCode":"            .map(|bar| bar.bar())\n            .collect(),\n    )\n}\n\n/// Converts a Nautilus bar specification to a Binance kline interval.\n///\n/// # Errors\n///\n/// Returns an error if the bar specification does not map to a supported\n/// Binance kline interval.\npub fn bar_spec_to_binance_interval(\n    bar_spec: BarSpecification,\n) -> anyhow::Result<BinanceKlineInterval> {\n    let step = bar_spec.step.get();\n    let interval = match bar_spec.aggregation {\n        BarAggregation::Second => match step {\n            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        },","sourceCodeStart":1419,"sourceCodeEnd":1455,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/common/parse.rs#L1419-L1455","documentation":"bar_spec_to_binance_interval maps a NautilusTrader BarSpecification onto a native Binance kline interval. For BarAggregation::Second only step 1 is accepted, because the venue offers exactly one second-based interval, '1s', and only on Spot; any other second step bails with this message.","triggerScenarios":"Requesting Binance bars (subscription or historical klines) with a BarType whose specification is 2-SECOND, 5-SECOND, 30-SECOND, etc. — any second step other than 1 — or requesting second bars on a venue/channel that does not carry the 1s interval.","commonSituations":"A strategy config written for a venue with richer intervals (e.g. 5s klines elsewhere) is pointed at Binance; a BarType string like '5-SECOND-LAST' is copied into config; second aggregation is attempted on futures where 1s klines do not exist.","solutions":["Switch to the only supported second interval: 1-SECOND (Spot only).","Use INTERNAL aggregation (e.g. 5-SECOND-LAST-INTERNAL) so NautilusTrader aggregates trade/quote ticks locally instead of requesting a venue interval.","Check the BarType string in config for a wrong step value."],"exampleFix":"// before\n// let bar_type = BarType::from(\"5-SECOND-LAST-EXTERNAL\");\n// -> Unsupported second interval: 5s\n\n// after: let NautilusTrader aggregate locally from trades\n// let bar_type = BarType::from(\"5-SECOND-LAST-INTERNAL\");","handlingStrategy":"validation","validationCode":"fn supported_second_step(step: u32) -> bool {\n    step == 1 // Binance offers '1s' klines, Spot only\n}","typeGuard":"fn is_supported_second_bar(step: u32) -> bool {\n    step == 1\n}","tryCatchPattern":"let bar_type = BarType::from(\"5-SECOND-LAST-EXTERNAL\");\nif let Err(e) = data_client.subscribe_bars(bar_type) {\n    if e.to_string().contains(\"Unsupported second interval\") {\n        // fall back: 1-SECOND external or 5-SECOND-LAST-INTERNAL\n    } else {\n        return Err(e);\n    }\n}","preventionTips":["Validate bar specifications at config load time against the supported step sets.","Prefer INTERNAL aggregation for steps Binance does not natively serve.","Remember 1s klines exist on Spot only, not futures."],"tags":["binance","bars","klines","second-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"}