{"record":{"id":"3a1b5daf15ebc13f","repo":"nautechsystems/nautilus_trader","slug":"either-client-order-ids-or-venue-order-ids-must-be","errorCode":null,"errorMessage":"Either client_order_ids or venue_order_ids must be provided","messagePattern":"Either client_order_ids or venue_order_ids must be provided","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/bitmex/src/http/client.rs","lineNumber":1870,"sourceCode":"            }\n            params.order_id(\n                venue_order_ids\n                    .iter()\n                    .map(|id| id.to_string())\n                    .collect::<Vec<_>>(),\n            );\n        } else if let Some(client_order_ids) = client_order_ids {\n            if client_order_ids.is_empty() {\n                anyhow::bail!(\"client_order_ids cannot be empty\");\n            }\n            params.cl_ord_id(\n                client_order_ids\n                    .iter()\n                    .map(|id| id.to_string())\n                    .collect::<Vec<_>>(),\n            );\n        } else {\n            anyhow::bail!(\"Either client_order_ids or venue_order_ids must be provided\");\n        }\n\n        let params = params.build().map_err(|e| anyhow::anyhow!(e))?;\n\n        let orders: Vec<BitmexOrder> = self.inner.cancel_orders_response(params).await?;\n\n        let ts_init = self.generate_ts_init();\n        let instrument = self.instrument_from_cache(instrument_id.symbol.inner())?;\n\n        let mut reports = Vec::new();\n\n        for order in orders {\n            reports.push(parse_order_status_report(\n                &order,\n                &instrument,\n                &self.order_type_cache,\n                ts_init,\n            )?);","sourceCodeStart":1852,"sourceCodeEnd":1888,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bitmex/src/http/client.rs#L1852-L1888","documentation":"Raised by cancel_orders when neither client_order_ids nor venue_order_ids is provided (both None). BitMEX's cancel endpoint requires order identifiers; there is no 'cancel without ID' mode on this HTTP method. The adapter refuses to build a request that would be invalid.","triggerScenarios":"Calling cancel_orders(None, None). Happens when caller logic conditionally builds both ID lists and both end up None, or a default-arguments call path omits both.","commonSituations":"Generic cancel wrappers that forward optional IDs from upstream commands where the order execution engine did not populate either identifier.","solutions":["Pass at least one of client_order_ids or venue_order_ids","Ensure the upstream order object carries a valid client_order_id or venue_order_id before cancelling","Use cancel_all_orders instead if the goal is to clear all orders on a symbol"],"exampleFix":"// before\nclient.cancel_orders(cmd.client_order_ids, cmd.venue_order_ids).await?;\n// after\nensure!(cmd.client_order_ids.is_some() || cmd.venue_order_ids.is_some(), \"no order ids to cancel\");\nclient.cancel_orders(cmd.client_order_ids, cmd.venue_order_ids).await?;","handlingStrategy":"validation","validationCode":"ensure!(client_order_ids.is_some() || venue_order_ids.is_some(), \"cancel_orders requires order ids\");\nclient.cancel_orders(client_order_ids, venue_order_ids).await?;","typeGuard":"fn has_any_id(c: &Option<Vec<ClientOrderId>>, v: &Option<Vec<VenueOrderId>>) -> bool {\n    c.as_ref().is_some_and(|x| !x.is_empty()) || v.as_ref().is_some_and(|x| !x.is_empty())\n}","tryCatchPattern":"match client.cancel_orders(client_order_ids, venue_order_ids).await {\n    Ok(reports) => { /* handle */ }\n    Err(e) if e.to_string().contains(\"must be provided\") => { /* surface input bug */ }\n    Err(e) => return Err(e),\n}","preventionTips":["Validate that order objects carry at least one identifier before issuing cancel commands","Use cancel_all_orders when the intent is symbol-wide cancellation","Keep client_order_id <-> venue_order_id mapping populated in your cache"],"tags":["rust","bitmex","validation","missing-argument"],"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"}