{"record":{"id":"9fe6f84da0a3b0a5","repo":"nautechsystems/nautilus_trader","slug":"derive-request-instruments-requires-at-least-one-c","errorCode":null,"errorMessage":"Derive request_instruments requires at least one configured currency (DeriveDataClientConfig::currencies)","messagePattern":"Derive request_instruments requires at least one configured currency \\(DeriveDataClientConfig::currencies\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/derive/src/data.rs","lineNumber":1565,"sourceCode":"                    price,\n                    clock.get_time_ns(),\n                    params,\n                ),\n            );\n\n            if let Err(e) = sender.send(DataEvent::Response(response)) {\n                log::error!(\"Failed to send option-chain reference price response: {e}\");\n            }\n            Ok(())\n        });\n\n        Ok(())\n    }\n\n    fn request_instruments(&self, request: RequestInstruments) -> anyhow::Result<()> {\n        let currencies = self.config.currencies.clone();\n        if currencies.is_empty() {\n            anyhow::bail!(\n                \"Derive request_instruments requires at least one configured currency \\\n                 (DeriveDataClientConfig::currencies)\"\n            );\n        }\n\n        let http_client = self.http_client.clone();\n        let include_expired = self.config.include_expired;\n        let instruments_cache = Arc::clone(&self.instruments);\n        let sender = self.data_sender.clone();\n        let clock = self.clock;\n        let venue = self.venue().unwrap_or(*DERIVE_VENUE);\n        let client_id = request.client_id.unwrap_or(self.client_id);\n        let request_id = request.request_id;\n        let start_nanos = datetime_to_unix_nanos(request.start);\n        let end_nanos = datetime_to_unix_nanos(request.end);\n        let params = request.params;\n\n        self.spawn_task(\"request_instruments\", async move {","sourceCodeStart":1547,"sourceCodeEnd":1583,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/derive/src/data.rs#L1547-L1583","documentation":"Raised by `request_instruments` when the DeriveDataClientConfig has an empty `currencies` list. The Derive instruments REST query is per-currency, so at least one configured currency is required to know which instrument sets to fetch.","triggerScenarios":"Calling request_instruments (or instrument loading flows that depend on it) while `DeriveDataClientConfig::currencies` is empty — e.g. building the config without the currencies field or with an empty vec.","commonSituations":"Copy-pasting a minimal config that omits currencies; dynamically building config and forgetting to populate currencies; clearing currencies to 'fetch everything' (not supported — Derive requires explicit currencies).","solutions":["Add at least one currency (e.g. [\"ETH\", \"BTC\"]) to DeriveDataClientConfig::currencies.","Validate config.currencies is non-empty before creating the data client.","List all currencies for the instruments you plan to subscribe to so lazy loading can find them."],"exampleFix":"// before\nlet config = DeriveDataClientConfig { currencies: vec![], ..cfg };\n// after\nlet config = DeriveDataClientConfig { currencies: vec![\"ETH\".into(), \"BTC\".into()], ..cfg };","handlingStrategy":"validation","validationCode":"assert!(!config.currencies.is_empty(), \"DeriveDataClientConfig::currencies must list at least one currency\");","typeGuard":null,"tryCatchPattern":"if let Err(e) = request_instruments(req).await {\n    if e.to_string().contains(\"configured currency\") {\n        // repopulate currencies in config and retry\n    }\n}","preventionTips":["Always populate currencies in DeriveDataClientConfig.","Assert non-empty currencies right after config deserialization.","List every currency whose instruments you intend to load."],"tags":["configuration","instruments","empty-collection","derive"],"backgroundTag":"missing-required-config-field","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"}