{"record":{"id":"8685c10cbb17c249","repo":"nautechsystems/nautilus_trader","slug":"unsupported-binance-instrument-filter-key-for","errorCode":null,"errorMessage":"unsupported Binance instrument filter {key:?} for {product_type:?}","messagePattern":"unsupported Binance instrument filter (.+?) for (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/config.rs","lineNumber":115,"sourceCode":"        if let Some(load_ids) = &self.load_ids {\n            for raw in load_ids {\n                let instrument_id = InstrumentId::from_str(raw)\n                    .map_err(|e| anyhow::anyhow!(\"invalid Binance load_ids value {raw:?}: {e}\"))?;\n                anyhow::ensure!(\n                    instrument_id.venue.as_str() == \"BINANCE\",\n                    \"Binance load_ids value {raw:?} must use venue BINANCE\"\n                );\n            }\n        }\n\n        for (key, value) in &self.filters {\n            let supported = matches!(key.as_str(), \"symbols\" | \"bases\" | \"quotes\")\n                || key == \"contract_types\"\n                    && matches!(\n                        product_type,\n                        BinanceProductType::UsdM | BinanceProductType::CoinM\n                    );\n            anyhow::ensure!(\n                supported,\n                \"unsupported Binance instrument filter {key:?} for {product_type:?}\"\n            );\n            validate_filter_strings(key, value)?;\n        }\n\n        Ok(())\n    }\n}\n\nfn validate_filter_strings(name: &str, value: &serde_json::Value) -> anyhow::Result<()> {\n    let valid = match value {\n        serde_json::Value::String(value) => !value.trim().is_empty(),\n        serde_json::Value::Array(values) => {\n            !values.is_empty()\n                && values\n                    .iter()\n                    .all(|value| value.as_str().is_some_and(|value| !value.trim().is_empty()))","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/config.rs#L97-L133","documentation":"BinanceDataClientConfig::instrument_provider filters are restricted to a whitelist. 'symbols', 'bases', and 'quotes' are always supported, while 'contract_types' is only valid for USD-M and COIN-M futures product types. validate() throws this error when an unknown filter key is supplied or when 'contract_types' is used with a non-futures product type (e.g. Spot).","triggerScenarios":"Calling BinanceDataClientConfig::validate() (directly or via request_instruments_with_config) with an instrument_provider config whose filters map contains a key other than symbols/bases/quotes, or containing 'contract_types' while product_type is Spot or another non-futures BinanceProductType.","commonSituations":"Copying a futures config example into a Spot client setup; typo'd filter keys like 'base' or 'symbol'; forward-porting config from a version that accepted more filter keys.","solutions":["Use only 'symbols', 'bases', or 'quotes' filter keys.","If using 'contract_types', set product_type to BinanceProductType::UsdM or BinanceProductType::CoinM.","For Spot product types, remove 'contract_types' from the instrument filters.","Fix any typos in filter key names."],"exampleFix":"// before\nfilters.insert(\"contract_types\", json!([\"PERPETUAL\"])); // product_type: Spot\n// after\nfilters.insert(\"symbols\", json!([\"BTCUSDT\"])); // or switch product_type to UsdM/CoinM","handlingStrategy":"validation","validationCode":"const ALLOWED_ALWAYS: [&str; 3] = [\"symbols\", \"bases\", \"quotes\"];\nfn filters_valid(filters: &[&str], product_type: BinanceProductType) -> bool {\n    filters.iter().all(|k| {\n        ALLOWED_ALWAYS.contains(k)\n            || (*k == \"contract_types\"\n                && matches!(product_type, BinanceProductType::UsdM | BinanceProductType::CoinM))\n    })\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep filter keys limited to symbols/bases/quotes unless on USD-M/COIN-M futures.","Build filters with typed constants instead of raw string literals.","Share one config-building helper between Spot and futures setups so product-specific keys stay consistent."],"tags":["config","validation","binance","instrument-provider"],"backgroundTag":"unsupported-config-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}