{"record":{"id":"2bbe148dd423c12e","repo":"nautechsystems/nautilus_trader","slug":"either-client-order-id-or-venue-order-id-must-be-p-2bbe14","errorCode":null,"errorMessage":"Either client_order_id or venue_order_id must be provided","messagePattern":"Either client_order_id or venue_order_id must be provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/bybit/src/http/client.rs","lineNumber":2704,"sourceCode":"        &self,\n        account_id: AccountId,\n        product_type: BybitProductType,\n        instrument_id: InstrumentId,\n        client_order_id: Option<ClientOrderId>,\n        venue_order_id: Option<VenueOrderId>,\n    ) -> anyhow::Result<OrderStatusReport> {\n        let instrument = self.instrument_from_cache(&instrument_id.symbol)?;\n        let bybit_symbol = BybitSymbol::new(instrument_id.symbol.as_str())?;\n\n        let mut cancel_entry = BybitBatchCancelOrderEntryBuilder::default();\n        cancel_entry.symbol(bybit_symbol.raw_symbol().to_string());\n\n        if let Some(venue_order_id) = venue_order_id {\n            cancel_entry.order_id(venue_order_id.to_string());\n        } else if let Some(client_order_id) = client_order_id {\n            cancel_entry.order_link_id(client_order_id.to_string());\n        } else {\n            anyhow::bail!(\"Either client_order_id or venue_order_id must be provided\");\n        }\n\n        let cancel_entry = cancel_entry.build().build_anyhow()?;\n\n        let mut params = BybitCancelOrderParamsBuilder::default();\n        params.category(product_type);\n        params.order(cancel_entry);\n\n        let params = params.build().build_anyhow()?;\n        let body = serde_json::to_vec(&params)?;\n\n        let response: BybitPlaceOrderResponse = self\n            .inner\n            .send_request::<_, ()>(Method::POST, \"/v5/order/cancel\", None, Some(body), true)\n            .await?;\n\n        let order_id = response\n            .result","sourceCodeStart":2686,"sourceCodeEnd":2722,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bybit/src/http/client.rs#L2686-L2722","documentation":"Bybit identifies orders either by its own orderId or by the client-supplied orderLinkId. The cancel-order request builder requires at least one of them; the adapter bails when both are None because the request would be invalid.","triggerScenarios":"Calling cancel_order on the Bybit HTTP client with both venue_order_id and client_order_id as None.","commonSituations":"A caller that lost track of the order identifiers, e.g. passing through an event where neither ID was populated; constructing cancel requests programmatically with unwrapped-then-dropped Option values.","solutions":["Always supply the venue_order_id if the order was acknowledged by the venue","Otherwise supply the client_order_id used at submission","Add a caller-side check that at least one identifier is Some before invoking the client"],"exampleFix":"// before\nclient.cancel_order(product_type, symbol, None, None).await?;\n// after\nclient.cancel_order(product_type, symbol, Some(venue_order_id), None).await?","handlingStrategy":"validation","validationCode":"anyhow::ensure!(venue_order_id.is_some() || client_order_id.is_some(), \"cancel needs venue_order_id or client_order_id\");","typeGuard":"fn has_order_id(v: &Option<VenueOrderId>, c: &Option<ClientOrderId>) -> bool { v.is_some() || c.is_some() }","tryCatchPattern":"match client.cancel_order(pt, symbol, venue_id, client_id).await {\n    Err(e) if e.to_string().contains(\"must be provided\") => { /* resolve identifier from cache and retry */ }\n    other => other?,\n}","preventionTips":["Store the client_order_id for every submitted order","Update venue_order_id from order accepted events","Never construct cancel calls with both identifiers None"],"tags":["bybit","cancel-order","missing-identifier"],"backgroundTag":"missing-required-argument","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"}