nautechsystems/nautilus_trader · error

Continuous future {key} venue mismatch for {target_instrumen

Error message

Continuous future {key} venue mismatch for {target_instrument_id}: target venue {}, {key} venue {}

What it means

An optional chain bound (e.g. first/last instrument) parsed for a continuous future is on a different venue than the target continuous instrument. All chain bounds must belong to the same venue as the continuous series itself.

Source

Thrown at crates/data/src/engine/requests.rs:506

        Some(3) => Ok(ContinuousFutureAdjustmentType::BackwardRatio),
        Some(4) => Ok(ContinuousFutureAdjustmentType::ForwardRatio),
        _ => anyhow::bail!("failed to parse `{CONTINUOUS_FUTURE_ADJUSTMENT_MODE}`"),
    }
}

fn parse_optional_chain_bound(
    params: &Params,
    key: &str,
    target_instrument_id: InstrumentId,
) -> anyhow::Result<Option<InstrumentId>> {
    let Some(raw) = params.get_str(key) else {
        return Ok(None);
    };

    let instrument_id = InstrumentId::from_str(raw)
        .with_context(|| format!("Invalid continuous future {key} for {target_instrument_id}"))?;
    if instrument_id.venue != target_instrument_id.venue {
        anyhow::bail!(
            "Continuous future {key} venue mismatch for {target_instrument_id}: target venue {}, {key} venue {}",
            target_instrument_id.venue,
            instrument_id.venue,
        );
    }

    Ok(Some(instrument_id))
}

fn parse_transitions(
    target_bar_type: BarType,
    value: &Value,
    is_ratio: bool,
) -> anyhow::Result<Vec<ContinuousFutureTransition>> {
    let values = value
        .as_array()
        .context("Continuous future transitions must be an array")?;
    let target_venue = target_bar_type.instrument_id().venue;

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Correct the bound's venue suffix so it matches the target continuous instrument's venue.
  2. Verify the bound belongs to the same product family/venue as the continuous series.
  3. Filter bounds by venue before building request params.

Example fix

// before
"first_pre_instrument_id": "RTYZ5-ICE" // target is ES...CME
// after
"first_pre_instrument_id": "ESZ5-CME"
Defensive patterns

Strategy: validation

Validate before calling

assert_eq!(bound.venue, target_instrument_id.venue, "chain bound venue mismatch");

Type guard

fn same_venue(a: &InstrumentId, b: &InstrumentId) -> bool { a.venue == b.venue }

Prevention

When it happens

Trigger: parse_optional_chain_bound is given an instrument ID (via a chain-bound request parameter) whose venue differs from target_instrument_id's venue, e.g. bound "NQZ5-CME" for target "ES.C-...-CME" is fine, but "RTYZ5-ICE" is not.

Common situations: Copy-pasting bounds from another exchange's roll table; using the wrong venue suffix (-ICE vs -CME); mixing contract chains across venues in config.

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/bb3c4cadad61c3de. Report an issue: GitHub.