{"record":{"id":"a04693d675ca7b6e","repo":"nautechsystems/nautilus_trader","slug":"order-detail-returned-records-for-one-identifie","errorCode":null,"errorMessage":"Order detail returned {} records for one identifier","messagePattern":"Order detail returned (.+?) records for one identifier","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/okx/src/http/client.rs","lineNumber":4391,"sourceCode":"                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 an order detail request\"\n            ),\n        }\n\n        let params = params_builder\n            .build()\n            .map_err(|e| anyhow::anyhow!(\"Failed to build order detail params: {e}\"))?;\n        let orders = match self.inner.get_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 order = match orders.as_slice() {\n            [] => return Ok(None),\n            [order] => order,\n            _ => anyhow::bail!(\n                \"Order detail returned {} records for one identifier\",\n                orders.len(),\n            ),\n        };\n\n        if order.inst_id.as_str() != instrument_id.symbol.inner() {\n            anyhow::bail!(\n                \"Order detail instrument mismatch for {instrument_id}: returned {}\",\n                order.inst_id,\n            );\n        }\n\n        if let Some(venue_order_id) = venue_order_id\n            && order.ord_id.as_str() != venue_order_id.as_str()\n        {\n            anyhow::bail!(\n                \"Order detail venue order ID mismatch for {venue_order_id}: returned {}\",\n                order.ord_id,","sourceCodeStart":4373,"sourceCodeEnd":4409,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/okx/src/http/client.rs#L4373-L4409","documentation":"After fetching order detail, the adapter expects the response to contain at most one record since the query targeted a single order ID. If OKX returns multiple records for one identifier, the adapter treats it as an API contract violation and bails, since it cannot determine which record represents the order.","triggerScenarios":"request_order_detail receives an OKX response whose orders array has more than one element for the single clOrdId/ordId queried (observed after the [] and [order] match arms fail).","commonSituations":"OKX API behavior changes or archival/query quirks returning duplicates; requesting by a non-unique clOrdId after clientOrderId reuse; unexpected exchange-side state.","solutions":["Query with the unique venue_order_id (ordId) instead of client_order_id to guarantee a single record","Log the response and retry the request once — a transient duplicate may resolve","If it persists, treat it as an exchange-side anomaly: report/inspect the raw response and contact OKX support"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match client.request_order_detail(instrument_id, None, Some(void)).await {\n    Ok(report) => { /* use */ }\n    Err(e) if e.to_string().contains(\"Order detail returned\") => {\n        // duplicate records for one identifier: retry or escalate\n        log::warn!(\"ambiguous order detail response: {e}\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Use unique client_order_ids to avoid multi-record matches","Query by venue_order_id (ordId) for guaranteed single-record lookups","Monitor OKX API changelog for response-shape changes"],"tags":["okx","orders","unexpected-response","api"],"backgroundTag":"unexpected-response-shape","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"}