nautechsystems/nautilus_trader · error

Either venue_order_id or client_order_id must be provided

Error message

Either venue_order_id or client_order_id must be provided

What it means

Raised by request_order_status_report when both venue_order_id and client_order_id are None. This report-generation method requires an order identifier to build the filter for the BitMEX /order request. It fails fast instead of querying without a target order.

Source

Thrown at crates/adapters/bitmex/src/http/client.rs:2074

        Ok(Some(report))
    }

    /// Request a single order status report.
    ///
    /// # Errors
    ///
    /// Returns an error if:
    /// - Credentials are missing.
    /// - The request fails.
    /// - The API returns an error.
    pub async fn request_order_status_report(
        &self,
        instrument_id: InstrumentId,
        client_order_id: Option<ClientOrderId>,
        venue_order_id: Option<VenueOrderId>,
    ) -> anyhow::Result<OrderStatusReport> {
        if venue_order_id.is_none() && client_order_id.is_none() {
            anyhow::bail!("Either venue_order_id or client_order_id must be provided");
        }

        let mut params = GetOrderParamsBuilder::default();
        params.symbol(instrument_id.symbol.as_str());

        if let Some(venue_order_id) = venue_order_id {
            params.filter(serde_json::json!({
                "orderID": venue_order_id.as_str()
            }));
        } else if let Some(client_order_id) = client_order_id {
            params.filter(serde_json::json!({
                "clOrdID": client_order_id.as_str()
            }));
        }

        params.count(1i32);
        let params = params.build().map_err(|e| anyhow::anyhow!(e))?;

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Supply venue_order_id (checked first) or client_order_id when calling the method
  2. Resolve the identifier from the order cache or a prior submit response before requesting the report
  3. Skip the report request when no identifiers exist for the order

Example fix

// before
let report = client.request_order_status_report(instrument_id, None, None).await?;
// after
if venue_order_id.is_none() && client_order_id.is_none() { return Ok(()); }
let report = client.request_order_status_report(instrument_id, client_order_id, venue_order_id).await?;
Defensive patterns

Strategy: validation

Validate before calling

ensure!(venue_order_id.is_some() || client_order_id.is_some(), "request_order_status_report requires an order id");
let report = client.request_order_status_report(instrument_id, client_order_id, venue_order_id).await?;

Type guard

fn reportable(c: &Option<ClientOrderId>, v: &Option<VenueOrderId>) -> bool {
    c.is_some() || v.is_some()
}

Try / catch

match client.request_order_status_report(instrument_id, client_order_id, venue_order_id).await {
    Ok(report) => { /* handle */ }
    Err(e) if e.to_string().contains("must be provided") => { /* input bug */ }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling request_order_status_report without either identifier. Typically a caller building reconciliation or status flows that did not resolve an order ID from the upstream command.

Common situations: Reconciliation sweeps for a specific order where the generate_order_status_report command carried no IDs; handling generate-order-status events before any order was submitted.

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