{"record":{"id":"97a8e76584f47186","repo":"nautechsystems/nautilus_trader","slug":"either-client-order-id-or-venue-order-id-must-be-p-97a8e7","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/kraken/src/http/futures/client.rs","lineNumber":2319,"sourceCode":"    /// - Neither client_order_id nor venue_order_id is provided.\n    /// - The request fails.\n    /// - The order cancellation is rejected.\n    pub async fn cancel_order(\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<()> {\n        let _ = self\n            .get_cached_instrument(&instrument_id.symbol.inner())\n            .ok_or_else(|| InstrumentLookupError::not_found(instrument_id))?;\n\n        let order_id = venue_order_id.as_ref().map(|id| id.to_string());\n        let cli_ord_id = client_order_id.as_ref().map(truncate_cl_ord_id);\n\n        if order_id.is_none() && cli_ord_id.is_none() {\n            anyhow::bail!(\"Either client_order_id or venue_order_id must be provided\");\n        }\n\n        let response = self.inner.cancel_order(order_id, cli_ord_id).await?;\n\n        if response.result != KrakenApiResult::Success {\n            let status = &response.cancel_status.status;\n            anyhow::bail!(\"Order cancellation failed: {status}\");\n        }\n\n        Ok(())\n    }\n\n    /// Cancels multiple orders on the Kraken Futures exchange.\n    ///\n    /// Automatically chunks requests into batches of 50 orders.\n    ///\n    /// # Parameters\n    /// - `venue_order_ids` - List of venue order IDs to cancel.","sourceCodeStart":2301,"sourceCodeEnd":2337,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/kraken/src/http/futures/client.rs#L2301-L2337","documentation":"cancel_order on Kraken Futures requires at least one order identifier. Both venue_order_id and client_order_id were None, so the client cannot tell Kraken which order to cancel and bails before making the request.","triggerScenarios":"Calling cancel_order passing neither a venue_order_id nor a client_order_id (both None / both omitted), e.g. cancelling from a partially reconciled order state where neither identifier was stored.","commonSituations":"Strategy code holding an order ref that was never populated after submit; deserialization or event handling that dropped the client_order_id; calling the raw HTTP client directly without passing an id.","solutions":["Pass at least one identifier: provide the venue_order_id from the order status report, or the client_order_id used at submit.","If the order was submitted by your strategy, use ClientOrderId as it is truncated and sent via cli_ord_id.","Look up the order in your cache (order registry) to recover the venue_order_id before cancelling.","Add a caller-side check that at least one id is Some before invoking cancel_order."],"exampleFix":"// before\nclient.cancel_order(instrument_id, None, None).await?;\n\n// after\nclient.cancel_order(instrument_id, Some(client_order_id), None).await?;","handlingStrategy":"validation","validationCode":"if venue_order_id.is_none() && client_order_id.is_none() {\n    return Err(\"cancel_order requires venue_order_id or client_order_id\");\n}\nclient.cancel_order(instrument_id, venue_order_id, client_order_id).await?;","typeGuard":"fn is_cancellable(venue: Option<&VenueOrderId>, client: Option<&ClientOrderId>) -> bool {\n    venue.is_some() || client.is_some()\n}","tryCatchPattern":"match client.cancel_order(instrument_id, vid, cid).await {\n    Err(e) if e.to_string().contains(\"Either client_order_id or venue_order_id\") => log::error!(\"no order id supplied for cancel\"),\n    Err(e) => return Err(e),\n    Ok(_) => {}\n}","preventionTips":["Store both client and venue order ids at submit acknowledgment time","Reuse the ExecutionClient cache to resolve ids before cancelling","Never call cancel with an unacknowledged order record"],"tags":["cancel-order","missing-identifier","kraken-futures","validation"],"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-14T05:17:10.506Z"}