nautechsystems/nautilus_trader · error · anyhow::Error

invalid Binance load_ids value

Error message

invalid Binance load_ids value {raw:?}: {e}

What it means

BinanceDataClientConfig / BinanceExecClientConfig validation failed because a load_ids entry could not be parsed as an InstrumentId at all. Each load_ids value must be a valid instrument ID like "BTCUSDT.BINANCE".

Solutions

  1. Write each entry as <SYMBOL>.BINANCE, e.g. "BTCUSDT.BINANCE"
  2. Remove whitespace and stray characters from the load_ids strings
  3. Use Symbol(Venue) syntax only — not pair notation like BTC/USDT
  4. Check the config file encoding and quoting

Example fix

// before
load_ids = ["BTCUSDT", "ETH/USDT"]
// after
load_ids = ["BTCUSDT.BINANCE", "ETHUSDT.BINANCE"]
Defensive patterns

Strategy: validation

Validate before calling

raw.parse::<rust_decimal::Decimal>().ok(); // placeholder
let ok = raws.iter().all(|r| nautilus_model::identifiers::InstrumentId::from_str(r).map(|i| i.venue.as_str() == "BINANCE").unwrap_or(false));

Type guard

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

Try / catch

config.validate().map_err(|e| { eprintln!("config invalid: {e}"); std::process::exit(1); })?;

Prevention

When it happens

Trigger: request_instruments_with_config calling config.validate() when load_ids contains strings that are not parseable InstrumentIds — missing venue, wrong separator (e.g. "BTCUSDT" or "BTC/USDT"), whitespace, or typos.

Common situations: Config files listing bare symbols instead of symbol.venue form; using trading-pair notation like BTC-USDT or BTC/USDT; YAML/JSON quoting errors adding stray characters.

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

Appendix: source

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

    /// Returns an error for malformed IDs, unsupported filters, or a legacy
    /// 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:?}"
            );

View on GitHub (pinned to 18893faf8b)