nautechsystems/nautilus_trader · error

Either client_order_id or venue_order_id is required

Error message

Either client_order_id or venue_order_id is required

What it means

request_order_status_report can look up an order by client_order_id, by venue_order_id, or via resolve_order_context, but with neither ID provided there is no way to identify the order. The HTTP client bails immediately in the (None, None) match arm before calling get_order.

Source

Thrown at crates/adapters/coinbase/src/http/client.rs:1167

                let query = OrderListQuery {
                    client_order_id_filter: Some(cid.as_str().to_string()),
                    ..Default::default()
                };
                let orders = self
                    .inner
                    .fetch_all_orders(&query)
                    .await
                    .map_err(|e| anyhow::anyhow!("Failed to fetch orders: {e}"))?;
                let order = orders
                    .into_iter()
                    .next()
                    .ok_or_else(|| anyhow::anyhow!("No order found for client_order_id={cid}"))?;
                let instrument = self.get_or_fetch_instrument(order.product_id).await?;
                let ts_init = self.ts_now();
                return parse_order_status_report(&order, &instrument, account_id, ts_init);
            }
            (None, None) => {
                anyhow::bail!("Either client_order_id or venue_order_id is required")
            }
        };

        let json = self
            .inner
            .get_order(venue_order_id.as_str())
            .await
            .map_err(|e| anyhow::anyhow!("Failed to fetch order: {e}"))?;
        let response: OrderResponse =
            serde_json::from_value(json).map_err(|e| anyhow::anyhow!(e))?;
        let instrument = self
            .get_or_fetch_instrument(response.order.product_id)
            .await?;
        let ts_init = self.ts_now();
        parse_order_status_report(&response.order, &instrument, account_id, ts_init)
    }

    /// Requests order status reports, optionally filtered by instrument, open

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Populate either client_order_id or venue_order_id before requesting the status report
  2. If only a client_order_id is known, pass it; the client resolves it against Coinbase's mappings
  3. Check upstream code that builds the report request to ensure an ID is set (resolve_order_context should supply one)
  4. Log the order struct at the call site to see which ID field is empty

Example fix

// before
client.request_order_status_report(&order_report_req).await?; // req has no ids

// after
let req = order_report_req.with_client_order_id(client_order_id);
client.request_order_status_report(&req).await?;
Defensive patterns

Strategy: validation

Validate before calling

if report_req.client_order_id.is_none() && report_req.venue_order_id.is_none() {
    return Err(anyhow!("order status request needs client_order_id or venue_order_id"));
}

Type guard

fn has_order_id(req: &OrderStatusReportRequest) -> bool {
    req.client_order_id.is_some() || req.venue_order_id.is_some()
}

Prevention

When it happens

Trigger: Calling request_order_status_report (directly or through resolve_order_context) with both client_order_id and venue_order_id as None — e.g. a request with blank/unset identifiers.

Common situations: Reconciliation/report generation passing through an order struct with unset IDs; a bug where one ID format is expected but never populated; serialization dropping empty ID fields.

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/4e4bb4653e020963. Report an issue: GitHub.