nautechsystems/nautilus_trader · error

Unsupported minute interval

Error message

Unsupported minute interval: {step}m

What it means

Binance minute klines exist only for fixed steps: 1, 3, 5, 15, and 30 minutes. When a BarSpecification requests Minute aggregation with any other step, bar_spec_to_binance_interval cannot map it to a BinanceKlineInterval and throws this error.

Solutions

  1. Change the bar step to a supported value: 1, 3, 5, 15, or 30 minutes
  2. Request a finer supported interval (e.g. 1-MINUTE) and resample to the target period inside the strategy
  3. Validate bar specs against the supported interval list at config load time
  4. Use a venue adapter that supports the desired minute step if the exact period is required

Example fix

// before
let bar_spec = BarSpecification::new(10, BarAggregation::Minute, PriceType::Last);
// after
let bar_spec = BarSpecification::new(15, BarAggregation::Minute, PriceType::Last); // supported by Binance
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_MINUTE_STEPS: [u64; 5] = [1, 3, 5, 15, 30];
fn is_supported_minute_step(step: u64) -> bool {
    SUPPORTED_MINUTE_STEPS.contains(&step)
}
// assert step is supported before building a Minute BarSpecification for Binance

Try / catch

let interval = bar_spec_to_binance_interval(bar_spec)
    .unwrap_or_else(|e| panic!("config error: {e}")); // fail fast at startup, not at subscribe time

Prevention

When it happens

Trigger: subscribe_bars / unsubscribe_bars (or bar_spec_to_binance_interval) called with BarAggregation::Minute and a step not in {1, 3, 5, 15, 30} — e.g. 2-MINUTE, 10-MINUTE, or 45-MINUTE bars on a Binance venue.

Common situations: Strategy configs reused across venues (many crypto venues support 2m/10m; Binance does not); programmatic generation of bar specs at arbitrary steps; migrating a config from an exchange with 10-minute candles to Binance.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/73aa65253dcb41bf. Report an issue: GitHub.

Appendix: source

Thrown at crates/adapters/binance/src/common/parse.rs:1439

///
/// Returns an error if the bar specification does not map to a supported
/// Binance kline interval.
pub fn bar_spec_to_binance_interval(
    bar_spec: BarSpecification,
) -> anyhow::Result<BinanceKlineInterval> {
    let step = bar_spec.step.get();
    let interval = match bar_spec.aggregation {
        BarAggregation::Second => match step {
            1 => BinanceKlineInterval::Second1,
            _ => anyhow::bail!("Unsupported second interval: {step}s"),
        },
        BarAggregation::Minute => match step {
            1 => BinanceKlineInterval::Minute1,
            3 => BinanceKlineInterval::Minute3,
            5 => BinanceKlineInterval::Minute5,
            15 => BinanceKlineInterval::Minute15,
            30 => BinanceKlineInterval::Minute30,
            _ => anyhow::bail!("Unsupported minute interval: {step}m"),
        },
        BarAggregation::Hour => match step {
            1 => BinanceKlineInterval::Hour1,
            2 => BinanceKlineInterval::Hour2,
            4 => BinanceKlineInterval::Hour4,
            6 => BinanceKlineInterval::Hour6,
            8 => BinanceKlineInterval::Hour8,
            12 => BinanceKlineInterval::Hour12,
            _ => anyhow::bail!("Unsupported hour interval: {step}h"),
        },
        BarAggregation::Day => match step {
            1 => BinanceKlineInterval::Day1,
            3 => BinanceKlineInterval::Day3,
            _ => anyhow::bail!("Unsupported day interval: {step}d"),
        },
        BarAggregation::Week => match step {
            1 => BinanceKlineInterval::Week1,
            _ => anyhow::bail!("Unsupported week interval: {step}w"),

View on GitHub (pinned to 18893faf8b)