{"record":{"id":"5715093ab7adde25","repo":"nautechsystems/nautilus_trader","slug":"exactly-one-of-client-order-id-or-venue-order-id-i-571509","errorCode":null,"errorMessage":"Exactly one of client_order_id or venue_order_id is required for a spread order detail request","messagePattern":"Exactly one of client_order_id or venue_order_id is required for a spread order detail request","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/okx/src/http/client.rs","lineNumber":7049,"sourceCode":"\n    pub(crate) async fn request_spread_order_status_report(\n        &self,\n        account_id: AccountId,\n        instrument_id: InstrumentId,\n        client_order_id: Option<ClientOrderId>,\n        venue_order_id: Option<VenueOrderId>,\n    ) -> anyhow::Result<Option<OrderStatusReport>> {\n        let instrument = self.instrument_from_cache(instrument_id.symbol.inner())?;\n        let mut params_builder = GetSpreadOrderParamsBuilder::default();\n\n        match (client_order_id, venue_order_id) {\n            (Some(client_order_id), None) => {\n                params_builder.cl_ord_id(client_order_id.as_str().to_string());\n            }\n            (None, Some(venue_order_id)) => {\n                params_builder.ord_id(venue_order_id.as_str().to_string());\n            }\n            _ => anyhow::bail!(\n                \"Exactly one of client_order_id or venue_order_id is required for a spread order detail request\"\n            ),\n        }\n\n        let params = params_builder\n            .build()\n            .map_err(|e| anyhow::anyhow!(\"Failed to build spread order detail params: {e}\"))?;\n        let orders = match self.inner.get_spread_order(params).await {\n            Ok(orders) => orders,\n            Err(e) if e.is_order_not_found() => return Ok(None),\n            Err(e) => return Err(e.into()),\n        };\n        let Some(order) = orders.into_iter().next() else {\n            return Ok(None);\n        };\n        let ts_init = self.generate_ts_init();\n        let report = parse_spread_order_status_report(\n            &order,","sourceCodeStart":7031,"sourceCodeEnd":7067,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/okx/src/http/client.rs#L7031-L7067","documentation":"When requesting a single spread order's details from OKX, exactly one identifier must be supplied: either the client order ID (sent as `clOrdId`) or the venue order ID (sent as `ordId`). Passing both, or neither, is ambiguous/invalid, so the client bails before building the request.","triggerScenarios":"Calling the spread order detail query with `client_order_id` and `venue_order_id` both `Some`, or both `None`.","commonSituations":"Passing an Nautilus `ClientOrderId` together with a `VenueOrderId` populated by reconciliation; calling the query from generic report code where neither ID was set.","solutions":["Pass exactly one of `client_order_id` or `venue_order_id` — prefer `venue_order_id` if you have it from a prior report.","If both are available, drop the client order ID and use the venue order ID.","If neither is known, first query order status reports to obtain an order ID."],"exampleFix":"// before\nclient.request_spread_order_detail(Some(&cl_ord_id), Some(&venue_ord_id)).await?;\n// after\nclient.request_spread_order_detail(None, Some(&venue_ord_id)).await?;","handlingStrategy":"validation","validationCode":"let n = client_order_id.is_some() as u8 + venue_order_id.is_some() as u8;\nif n != 1 {\n    return Err(anyhow::anyhow!(\"pass exactly one of client_order_id or venue_order_id\"));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer venue_order_id when both IDs are known from prior reports.","Never populate both Option fields from generic report-building code.","Obtain an order ID via order status reports when neither is available."],"tags":["okx","validation","parameters","spread-orders"],"backgroundTag":"mutually-exclusive-options","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"}