{"record":{"id":"996305492b675e90","repo":"nautechsystems/nautilus_trader","slug":"instrument-id-is-required-when-open-only-false","errorCode":null,"errorMessage":"instrument_id is required when open_only=false","messagePattern":"instrument_id is required when open_only=false","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/http/client.rs","lineNumber":3228,"sourceCode":"        &self,\n        account_id: AccountId,\n        instrument_id: Option<InstrumentId>,\n        start: Option<Timestamp>,\n        end: Option<Timestamp>,\n        open_only: bool,\n        limit: Option<u32>,\n    ) -> anyhow::Result<Vec<OrderStatusReport>> {\n        let ts_init = self.generate_ts_init();\n        let symbol = instrument_id.map(|id| id.symbol.to_string());\n\n        let orders = if open_only {\n            self.inner\n                .open_orders(symbol.as_deref())\n                .await\n                .map_err(|e| anyhow::anyhow!(e))?\n        } else {\n            let symbol = symbol\n                .ok_or_else(|| anyhow::anyhow!(\"instrument_id is required when open_only=false\"))?;\n            self.inner\n                .all_orders(\n                    &symbol,\n                    start.map(|dt| dt.as_millisecond()),\n                    end.map(|dt| dt.as_millisecond()),\n                    limit,\n                )\n                .await\n                .map_err(|e| anyhow::anyhow!(e))?\n        };\n\n        orders\n            .iter()\n            .map(|order| {\n                let symbol = Ustr::from(&order.symbol);\n                let instrument = self.instrument_from_cache(symbol)?;\n                parse_order_status_report_sbe(\n                    order,","sourceCodeStart":3210,"sourceCodeEnd":3246,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/spot/http/client.rs#L3210-L3246","documentation":"The query_orders method supports two modes: open_only=true queries open orders across all symbols, while open_only=false requires a specific symbol to call Binance's all_orders endpoint. When open_only=false and no instrument_id (hence no symbol) was supplied, the adapter rejects the call with this error rather than sending a request Binance would reject.","triggerScenarios":"Calling query_orders(instrument_id=None, open_only=False, ...) — the symbol extracted from instrument_id is None, hitting the ok_or_else guard at client.rs:3228.","commonSituations":"Requesting full order history without specifying which instrument; passing an empty/placeholder InstrumentId that serializes to no usable symbol; a caller that historically used open-only mode switched to open_only=false without adding the instrument_id argument.","solutions":["Pass a valid InstrumentId whose symbol resolves to a Binance symbol (e.g. InstrumentId::from(\"BTCUSDT.BINANCE\")) when open_only=false.","Set open_only=true if you actually want open orders for all symbols without a symbol filter.","Verify the instrument_id is registered in the adapter's instrument cache so its symbol converts to a valid string."],"exampleFix":"// before\nclient.query_orders(None, None, None, None, Some(false), None).await?;\n// after\nlet instrument_id = InstrumentId::from(\"BTCUSDT.BINANCE\");\nclient.query_orders(Some(instrument_id), None, None, None, Some(false), None).await?;","handlingStrategy":"validation","validationCode":"fn ensure_symbol_for_query(instrument_id: Option<InstrumentId>, open_only: bool) -> Result<(), String> {\n    if !open_only && instrument_id.is_none() {\n        return Err(\"instrument_id is required when open_only=false\".into());\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"match client.query_orders(instrument_id, None, None, None, Some(open_only), None).await {\n    Ok(orders) => orders,\n    Err(e) if e.to_string().contains(\"instrument_id is required\") => {\n        eprintln!(\"supply an InstrumentId like BTCUSDT.BINANCE when open_only=false\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Always pass a concrete InstrumentId for history (all_orders) queries.","Only use open_only=true when you intentionally want cross-symbol open orders.","Centralize query_orders calls behind a helper that enforces the argument contract."],"tags":["missing-argument","binance-spot","validation","api-contract"],"backgroundTag":"missing-required-argument","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}