{"record":{"id":"ba34a96da076ff19","repo":"nautechsystems/nautilus_trader","slug":"either-client-order-id-or-venue-order-id-must-be-p-ba34a9","errorCode":null,"errorMessage":"Either client_order_id or venue_order_id must be provided for each order","messagePattern":"Either client_order_id or venue_order_id must be provided for each order","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/bybit/src/http/client.rs","lineNumber":2794,"sourceCode":"        }\n\n        let mut cancel_entries = Vec::new();\n\n        for ((instrument_id, client_order_id), venue_order_id) in instrument_ids\n            .iter()\n            .zip(client_order_ids.iter())\n            .zip(venue_order_ids.iter())\n        {\n            let bybit_symbol = BybitSymbol::new(instrument_id.symbol.as_str())?;\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!(\n                    \"Either client_order_id or venue_order_id must be provided for each order\"\n                );\n            }\n\n            cancel_entries.push(cancel_entry.build().build_anyhow()?);\n        }\n\n        let chunk_limit = batch_endpoint_limit(product_type).min(batch_send_limit(product_type));\n        for chunk in cancel_entries.chunks(chunk_limit) {\n            let mut params = BybitBatchCancelOrderParamsBuilder::default();\n            params.category(product_type);\n            params.request(chunk.to_vec());\n\n            let params = params.build().build_anyhow()?;\n            let body = serde_json::to_vec(&params)?;\n\n            let _response: BybitPlaceOrderResponse = self\n                .inner","sourceCodeStart":2776,"sourceCodeEnd":2812,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bybit/src/http/client.rs#L2776-L2812","documentation":"In the batch cancel loop, each per-order entry must carry either the venue order ID or the client order ID. When both Options are None for an entry, the adapter bails because the individual cancel entry cannot be built for Bybit.","triggerScenarios":"Calling batch_cancel_all_orders with one or more positions in the parallel vectors where both client_order_ids[i] and venue_order_ids[i] are None.","commonSituations":"Batching cancels for orders whose venue acknowledgement never arrived and whose client ID was not stored; placeholder None entries used to pad the vectors to equal length.","solutions":["Ensure every batch element has at least one populated identifier","Filter out orders with no identifier and cancel them via a different path (e.g. cancel-all-orders by symbol)","Look up the venue order ID from the cache before batching"],"exampleFix":"// before\nclient_ids.push(None); venue_ids.push(None); // unpadded placeholder\n// after\nif client_id.is_none() && venue_id.is_none() { continue; } // or resolve from cache first","handlingStrategy":"validation","validationCode":"for (c, v) in client_order_ids.iter().zip(venue_order_ids.iter()) {\n    anyhow::ensure!(c.is_some() || v.is_some(), \"each order needs an identifier\");\n}","typeGuard":"fn entry_identifiable(c: &Option<ClientOrderId>, v: &Option<VenueOrderId>) -> bool { c.is_some() || v.is_some() }","tryCatchPattern":null,"preventionTips":["Resolve venue IDs from the cache before batching","Skip or handle separately orders lacking both IDs","Keep client_order_ids persisted for all live orders"],"tags":["bybit","batch-cancel","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"}