nautechsystems/nautilus_trader · error · anyhow::Error

Cannot parse Kraken Futures instrument '{symbol}': {field} {

Error message

Cannot parse Kraken Futures instrument '{symbol}': {field} {value} requires precision {precision}, but this build supports at most {FIXED_PRECISION}

What it means

When parsing a Kraken Futures instrument, a price/size precision value exceeded FIXED_PRECISION, the maximum decimal precision supported by this build. The check_futures_precision helper bails early so the instrument is never created with values that would lose accuracy. With the 'high-precision' Cargo feature enabled, a different variant of this same message is emitted (see companion error).

Source

Thrown at crates/adapters/kraken/src/common/parse.rs:465

        .ts_init(ts_init)
        .build()
        .unwrap();

    Ok(InstrumentAny::CryptoPerpetual(instrument))
}

fn check_futures_precision(
    symbol: &str,
    field: &str,
    value: impl Display,
    precision: u32,
) -> anyhow::Result<()> {
    if precision <= u32::from(FIXED_PRECISION) {
        return Ok(());
    }

    #[cfg(feature = "high-precision")]
    anyhow::bail!(
        "Cannot parse Kraken Futures instrument '{symbol}': {field} {value} requires precision \
         {precision}, but this build supports at most {FIXED_PRECISION}"
    );

    #[cfg(not(feature = "high-precision"))]
    anyhow::bail!(
        "Cannot parse Kraken Futures instrument '{symbol}': {field} {value} requires precision \
         {precision}, but this build supports at most {FIXED_PRECISION}; enable the \
         'high-precision' Cargo feature and rebuild"
    );
}

fn parse_price(value: &str, field: &str) -> anyhow::Result<Price> {
    Price::from_str(value).map_err(|e| anyhow::anyhow!("Failed to parse {field}='{value}': {e}"))
}

fn parse_quantity(value: &str, field: &str) -> anyhow::Result<Quantity> {
    Quantity::from_str(value).map_err(|e| anyhow::anyhow!("Failed to parse {field}='{value}': {e}"))

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Rebuild the crate with the high-precision Cargo feature: cargo build --features kraken/high-precision (or add it under crate features).
  2. If high precision is not needed, exclude the offending symbol from the instrument filter so it is never parsed.
  3. Verify the instrument's precision on Kraken's /instruments endpoint to confirm the requirement before rebuilding.

Example fix

// before (Cargo.toml)
nautilus-adapters = { path = "crates/adapters/kraken" }
// after
nautilus-adapters = { path = "crates/adapters/kraken", features = ["high-precision"] }
Defensive patterns

Strategy: validation

Validate before calling

// Before subscribing, check the instrument's tick size decimals
let decimals = tick_size_str.split('.').nth(1).map(|f| f.len()).unwrap_or(0);
if decimals > FIXED_PRECISION {
    eprintln!("skip {}: needs precision {} > {}", symbol, decimals, FIXED_PRECISION);
}

Try / catch

match parse_futures_instrument(...) {
    Err(e) if e.to_string().contains("requires precision") => skip_symbol(symbol),
    Err(e) => return Err(e),
    Ok(inst) => register(inst),
}

Prevention

When it happens

Trigger: parse_futures_instrument -> check_futures_precision is called with a symbol whose Kraken Futures tick_size, contract_value_tradeable, or similar field has more decimal places than FIXED_PRECISION, and the crate is compiled WITHOUT the 'high-precision' feature (this arm is #[cfg(feature = "high-precision")], so with high-precision this exact message fires with no rebuild hint).

Common situations: Subscribing to a Kraken Futures market with unusually fine tick sizes (e.g. highly quoted small-cap perpetuals); running a default build that lacks the high-precision feature while trading instruments needing extra decimals.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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