{"record":{"id":"f97d93d9c3d3168a","repo":"nautechsystems/nautilus_trader","slug":"spread-instrument-symbol-not-found","errorCode":null,"errorMessage":"Spread instrument {symbol} not found","messagePattern":"Spread instrument (.+?) not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/okx/src/http/client.rs","lineNumber":2701,"sourceCode":"\n        self.cache_instrument(instrument.clone());\n\n        Ok(instrument)\n    }\n\n    async fn request_spread_instrument(&self, symbol: &str) -> anyhow::Result<InstrumentAny> {\n        let resp = self\n            .inner\n            .get_spreads(GetSpreadsParams {\n                sprd_id: Some(symbol.to_string()),\n                ..Default::default()\n            })\n            .await\n            .map_err(|e| anyhow::anyhow!(e))?;\n\n        let raw_spread = resp\n            .first()\n            .ok_or_else(|| anyhow::anyhow!(\"Spread instrument {symbol} not found\"))?;\n        let ts_init = self.generate_ts_init();\n\n        parse_spread_instrument(raw_spread, None, None, None, None, ts_init)\n            .map_err(|e| OKXInstrumentDefinitionError::new(symbol, e).into())\n    }\n\n    /// Requests event contract series metadata from OKX.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the HTTP request fails or the response cannot be deserialized.\n    pub async fn request_event_contract_series(\n        &self,\n        params: GetEventContractSeriesParams,\n    ) -> Result<Vec<OKXEventContractSeries>, OKXHttpError> {\n        self.inner.get_event_contract_series(params).await\n    }\n","sourceCodeStart":2683,"sourceCodeEnd":2719,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/okx/src/http/client.rs#L2683-L2719","documentation":"Thrown by `request_spread_instrument` when OKX's spreads endpoint responds successfully but returns an empty list for the requested `sprd_id`. The adapter treats this as 'the spread instrument does not exist on OKX' and fails instrument loading for that symbol.","triggerScenarios":"Requesting an instrument for a spread symbol that OKX does not list (typo in symbol, delisted spread, or a synthetic/invented spread ID not registered on OKX).","commonSituations":"Config referencing a spread instrument ID that was delisted; symbol formatted incorrectly (must match OKX's sprd_id exactly, e.g. BTC-USDT_BTC-USDT-240329); querying before the spread's listing date.","solutions":["Verify the symbol matches an existing OKX sprd_id exactly (check OKX spread instruments endpoint or web UI).","Remove or correct the spread instrument in your adapter/venue configuration.","Check whether the spread was delisted and pick an active equivalent.","If the symbol is user-defined (custom spread), load it as a locally defined instrument instead of fetching from OKX."],"exampleFix":"// before\nlet instrument_id = InstrumentId::from_str(\"OKX-SPREAD/BTC-USDT_BTC-USDT-TYPO\")?;\n// after\nlet instrument_id = InstrumentId::from_str(\"OKX-SPREAD/BTC-USDT_BTC-USDT-240329\")?;","handlingStrategy":"validation","validationCode":"// Before loading, verify the spread exists on OKX\nlet exists = http.get_spreads(GetSpreadsParams { sprd_id: Some(symbol.into()), ..Default::default() }).await?.len() > 0;\nanyhow::ensure!(exists, \"unknown OKX spread: {symbol}\");","typeGuard":null,"tryCatchPattern":"match client.load_instrument(&spread_id).await {\n    Ok(inst) => Ok(Some(inst)),\n    Err(e) if e.to_string().contains(\"not found\") => { log::warn!(\"skipping unknown spread {spread_id}\"); Ok(None) }\n    Err(e) => Err(e),\n};","preventionTips":["Copy spread IDs exactly from OKX (sprd_id format) rather than typing them by hand.","Validate all configured instruments at startup and fail fast with a clear list of unknown symbols.","Periodically refresh instrument lists; remove delisted spreads from config.","Keep OKX instrument catalog dumps alongside config for cross-checking."],"tags":["not-found","okx","instrument","config"],"backgroundTag":"entity-not-found","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"}