{"record":{"id":"1e762b0f5f719871","repo":"nautechsystems/nautilus_trader","slug":"no-result-in-response","errorCode":null,"errorMessage":"No result in response","messagePattern":"No result in response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/deribit/src/http/client.rs","lineNumber":1026,"sourceCode":"    ///\n    /// Returns an error if the request fails or instruments cannot be parsed.\n    pub async fn request_instruments(\n        &self,\n        currency: DeribitCurrency,\n        product_type: Option<DeribitProductType>,\n    ) -> anyhow::Result<Vec<InstrumentAny>> {\n        // Build parameters\n        let params = if let Some(pt) = product_type {\n            GetInstrumentsParams::with_kind(currency, pt)\n        } else {\n            GetInstrumentsParams::new(currency)\n        };\n\n        // Call raw client\n        let full_response = self.inner.get_instruments(params).await?;\n        let result = full_response\n            .result\n            .ok_or_else(|| anyhow::anyhow!(\"No result in response\"))?;\n        let ts_event = extract_server_timestamp(full_response.us_out)?;\n        let ts_init = self.generate_ts_init();\n        let combo_by_id = self.combo_map_for_instruments(currency, &result).await;\n\n        // Parse each instrument\n        let mut instruments = Vec::new();\n        let mut skipped_count = 0;\n        let mut error_count = 0;\n\n        for raw_instrument in result {\n            match parse_deribit_instrument_any(&raw_instrument, ts_init, ts_event) {\n                Ok(Some(mut instrument)) => {\n                    if let Some(combo) = combo_by_id.get(&raw_instrument.instrument_name) {\n                        Self::attach_combo_leg_info(&mut instrument, combo);\n                    }\n                    instruments.push(instrument);\n                }\n                Ok(None) => {","sourceCodeStart":1008,"sourceCodeEnd":1044,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/deribit/src/http/client.rs#L1008-L1044","documentation":"request_instruments calls the raw Deribit get_instruments endpoint and then unwraps full_response.result. When the JSON-RPC response arrives without a 'result' field (no instrument data), the ok_or_else raises 'No result in response'. This indicates the API answered (no transport/HTTP error) but returned an empty or error-shaped payload.","triggerScenarios":"Calling request_instruments with a currency/kind combination that Deribit does not recognize (or an invalid currency code), so the API returns a response whose result field is absent; also possible during Deribit API outages or deprecations that alter the response schema.","commonSituations":"Typo'd or unsupported Currency/InstrumentKind mapping passed to the provider; querying a newly listed or delisted product the adapter hasn't mapped; Deribit returning an error payload that the raw client treats as a successful response with no result.","solutions":["Verify the currency and kind arguments are valid Deribit values (e.g. BTC, ETH; futures/options/perpetuals) and retry the request.","Log or inspect the full get_instruments response (including any error code/message fields) to see why Deribit omitted result.","Check Deribit API status and the adapter version for schema changes; update the adapter if Deribit changed the get_instruments response shape.","Check whether the raw client should have surfaced a JSON-RPC error instead — an API-level error being silently dropped as a result-less response is a client bug worth reporting."],"exampleFix":"// before\nlet result = full_response.result.ok_or_else(|| anyhow::anyhow!(\"No result in response\"))?;\n// after\nlet result = full_response.result.ok_or_else(|| {\n    anyhow::anyhow!(\n        \"No result in get_instruments response for currency={currency:?}: error={:?}\",\n        full_response.error,\n    )\n})?;","handlingStrategy":"retry","validationCode":"// Validate inputs before calling request_instruments\nfn is_supported_deribit_currency(code: &str) -> bool {\n    matches!(code, \"BTC\" | \"ETH\" | \"USDT\" | \"USDC\" | \"EUR\"\")\n}","typeGuard":"fn has_result<T>(resp: &JsonRpcResponse<T>) -> bool {\n    resp.result.is_some()\n}","tryCatchPattern":"match provider.request_instruments(currency, kind).await {\n    Ok(instruments) => instruments,\n    Err(e) if e.to_string().contains(\"No result in response\") => {\n        // log full raw response, back off, retry once\n        tokio::time::sleep(Duration::from_secs(2)).await;\n        provider.request_instruments(currency, kind).await?\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Use only currency/kind combinations the adapter documents as supported by Deribit.","Log the full raw JSON-RPC response on failure to distinguish an API error payload from a genuinely empty result.","Add a retry with backoff for transient Deribit-side schema/outage issues.","Monitor Deribit release notes for get_instruments response changes and keep the adapter updated."],"tags":["network","api","deribit","response-parsing"],"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-14T00:17:10.932Z"}