nautechsystems/nautilus_trader · error

Either client_order_id or venue_order_id must be provided

Error message

Either client_order_id or venue_order_id must be provided

What it means

amend_order on Kraken Spot requires an identifier for the order to amend: either the venue txid or the client order id. When both are None the client cannot address the edit request and bails before building the amend params.

Source

Thrown at crates/adapters/kraken/src/http/spot/client.rs:2885

    /// - The request fails.
    pub async fn modify_order(
        &self,
        instrument_id: InstrumentId,
        client_order_id: Option<ClientOrderId>,
        venue_order_id: Option<VenueOrderId>,
        quantity: Option<Quantity>,
        price: Option<Price>,
        trigger_price: Option<Price>,
    ) -> anyhow::Result<VenueOrderId> {
        let _ = self
            .get_cached_instrument(&instrument_id.symbol.inner())
            .ok_or_else(|| InstrumentLookupError::not_found(instrument_id))?;

        let txid = venue_order_id.as_ref().map(|id| id.to_string());
        let cl_ord_id = client_order_id.as_ref().map(truncate_cl_ord_id);

        if txid.is_none() && cl_ord_id.is_none() {
            anyhow::bail!("Either client_order_id or venue_order_id must be provided");
        }

        let mut builder = KrakenSpotAmendOrderParamsBuilder::default();
        if let Some(ref id) = txid {
            builder.txid(id.clone());
        } else if let Some(ref id) = cl_ord_id {
            builder.cl_ord_id(id.clone());
        }

        if let Some(qty) = quantity {
            builder.order_qty(qty.to_string());
        }

        if let Some(p) = price {
            builder.limit_price(p.to_string());
        }

        if let Some(tp) = trigger_price {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Pass the client_order_id (it is truncated and sent as cl_ord_id) when the venue txid is unknown.
  2. Pass venue_order_id (txid) from the original order status report when available.
  3. Retrieve the missing identifier from your order cache or the open-orders endpoint first.
  4. Guard the call site so amend is only attempted once at least one identifier exists.

Example fix

// before
client.amend_order(instrument_id, None, None, Some(new_qty), Some(new_price)).await?;

// after
client.amend_order(instrument_id, Some(venue_order_id), None, Some(new_qty), Some(new_price)).await?;
Defensive patterns

Strategy: validation

Validate before calling

if venue_order_id.is_none() && client_order_id.is_none() {
    return Err("amend_order requires venue_order_id or client_order_id");
}
client.amend_order(instrument_id, venue_order_id, client_order_id, qty, price).await?;

Type guard

fn is_amendable(venue: Option<&VenueOrderId>, client: Option<&ClientOrderId>) -> bool {
    venue.is_some() || client.is_some()
}

Try / catch

match client.amend_order(instrument_id, vid, cid, qty, price).await {
    Err(e) if e.to_string().contains("Either client_order_id or venue_order_id") => log::error!("no id supplied for amend"),
    Err(e) => return Err(e),
    Ok(_) => {}
}

Prevention

When it happens

Trigger: Calling amend_order with both venue_order_id and client_order_id omitted/None, e.g. amending an order whose submit ack has not arrived and whose client id was not passed.

Common situations: UI or strategy flows that let users edit orders before confirmation; lost linkage between local orders and venue ids after restart; forgetting to pass ClientOrderId when only a local order object is available.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/7c99c466658e1a3b. Report an issue: GitHub.