nautechsystems/nautilus_trader · error · anyhow::Error

Binance load_ids value {raw:?} must use venue BINANCE

Error message

Binance load_ids value {raw:?} must use venue BINANCE

What it means

A load_ids entry parsed as an InstrumentId but its venue is not BINANCE (e.g. "BTCUSDT.BYBIT" or "BTCUSDT.BINANCE-FUTURES"). Binance adapter configs only accept instrument IDs on the BINANCE venue; market selection is done via other config fields, not the venue.

Source

Thrown at crates/adapters/binance/src/config.rs:101

    /// callable filter that Binance v2 cannot execute safely.
    pub fn validate(&self, product_type: BinanceProductType) -> anyhow::Result<()> {
        if let Some(filter_callable) = self
            .filter_callable
            .as_deref()
            .map(str::trim)
            .filter(|value| !value.is_empty())
        {
            anyhow::bail!(
                "Binance v2 does not support instrument filter_callable {filter_callable:?}; \
                 the legacy Binance provider never applied callable filters"
            );
        }

        if let Some(load_ids) = &self.load_ids {
            for raw in load_ids {
                let instrument_id = InstrumentId::from_str(raw)
                    .map_err(|e| anyhow::anyhow!("invalid Binance load_ids value {raw:?}: {e}"))?;
                anyhow::ensure!(
                    instrument_id.venue.as_str() == "BINANCE",
                    "Binance load_ids value {raw:?} must use venue BINANCE"
                );
            }
        }

        for (key, value) in &self.filters {
            let supported = matches!(key.as_str(), "symbols" | "bases" | "quotes")
                || key == "contract_types"
                    && matches!(
                        product_type,
                        BinanceProductType::UsdM | BinanceProductType::CoinM
                    );
            anyhow::ensure!(
                supported,
                "unsupported Binance instrument filter {key:?} for {product_type:?}"
            );
            validate_filter_strings(key, value)?;

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Change the venue component to BINANCE (market type like futures is set elsewhere in config)
  2. Remove IDs for other venues and configure those adapters separately
  3. Audit load_ids for cross-adapter copy-paste mistakes

Example fix

// before
load_ids = ["BTCUSDT-PERP.BINANCE-FUTURES"]
// after
load_ids = ["BTCUSDT-PERP.BINANCE"]  # futures selected via market-type config
Defensive patterns

Strategy: validation

Validate before calling

for raw in load_ids { let id = InstrumentId::from_str(raw)?; assert_eq!(id.venue.as_str(), "BINANCE", "{raw} must use BINANCE venue"); }

Type guard

fn is_binance_id(s: &str) -> bool { InstrumentId::from_str(s).map(|i| i.venue.as_str() == "BINANCE").unwrap_or(false) }

Try / catch

if let Err(e) = config.validate() { eprintln!("load_ids venue mismatch: {e}"); return Err(e.into()); }

Prevention

When it happens

Trigger: config.validate() during request_instruments_with_config when load_ids contains IDs whose venue portion is anything other than the literal "BINANCE".

Common situations: Copy-pasting instrument IDs from other adapters; assuming futures needs "BINANCE-FUTURES" as venue instead of a market-type config option; multi-venue configs merged incorrectly.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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