{"record":{"id":"40c0e4f8a327bd22","repo":"nautechsystems/nautilus_trader","slug":"no-result-in-expirations-response","errorCode":null,"errorMessage":"No result in expirations response","messagePattern":"No result in expirations response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/deribit/src/http/client.rs","lineNumber":1952,"sourceCode":"\n    /// Requests traded option expirations for a settlement currency.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the request fails.\n    pub async fn request_option_expirations(\n        &self,\n        currency: DeribitCurrency,\n    ) -> anyhow::Result<Vec<String>> {\n        let params = GetExpirationsParams::new(currency.as_str(), DeribitExpirationKind::Option);\n        let full_response = self\n            .inner\n            .get_expirations(params)\n            .await\n            .map_err(|e| anyhow::anyhow!(e))?;\n        let response = full_response\n            .result\n            .ok_or_else(|| anyhow::anyhow!(\"No result in expirations response\"))?;\n        let expirations = response\n            .expirations_for_currency(currency.as_str())\n            .ok_or_else(|| anyhow::anyhow!(\"No option expirations for {currency}\"))?;\n\n        Ok(expirations.option.clone())\n    }\n\n    /// Requests position status reports for reconciliation.\n    ///\n    /// Fetches positions from Deribit and converts them to Nautilus [`PositionStatusReport`].\n    ///\n    /// # Strategy\n    /// - Uses `currency=any` to fetch all positions in one call\n    /// - Filters by instrument_id if provided\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the request fails or parsing fails.","sourceCodeStart":1934,"sourceCodeEnd":1970,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/deribit/src/http/client.rs#L1934-L1970","documentation":"request_option_expirations requires a `result` payload from public/get_instruments-style expiration data. The HTTP call succeeded but `result` was absent/null, so expiration data cannot be extracted. Deribit omits `result` on error responses.","triggerScenarios":"Calling request_option_expirations when the exchange returns an error-shaped response for the currency — invalid currency code or environment mismatch.","commonSituations":"Requesting a currency that does not list options on the connected environment (e.g. a fiat-only or unsupported currency), or typos in currency strings.","solutions":["Verify the currency supports options on this Deribit environment.","Check the response `error` field for the JSON-RPC error message.","Use uppercase canonical currency codes (BTC, ETH, SOL, USDT, USDC)."],"exampleFix":"// before\nlet response = full_response\n    .result\n    .ok_or_else(|| anyhow::anyhow!(\"No result in expirations response\"))?;\n// after\nlet response = full_response.result.ok_or_else(|| {\n    anyhow::anyhow!(\n        \"No result in expirations response for {currency} (error: {:?})\",\n        full_response.error\n    )\n})?;","handlingStrategy":"validation","validationCode":"// Only request expirations for currencies known to list options\nconst OPTION_CURRENCIES: [&str; 2] = [\"BTC\", \"ETH\"];\nassert!(OPTION_CURRENCIES.contains(&currency.to_uppercase().as_str()));","typeGuard":null,"tryCatchPattern":"match client.request_option_expirations(currency).await {\n    Ok(x) => handle(x),\n    Err(e) if e.to_string().contains(\"No result in expirations response\") => default_to_empty_expirations(currency),\n    Err(e) => return Err(e),\n}","preventionTips":["Use uppercase canonical currency codes","Confirm the currency lists options on the connected environment","Surface the response `error` field when result is null"],"tags":["http","api","empty-response","rust"],"backgroundTag":"empty-api-response","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"}