nautechsystems/nautilus_trader · warning · anyhow::Error

No order found for client_order_id={cid}

Error message

No order found for client_order_id={cid}

What it means

Raised by request_order_status_report when a lookup by client_order_id returns an empty order list: Coinbase accepted the query but no matching order exists. This is an empty-result condition after a successful fetch, distinct from the 'Failed to fetch orders' HTTP error.

Source

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

        venue_order_id: Option<VenueOrderId>,
    ) -> anyhow::Result<OrderStatusReport> {
        let venue_order_id = match (venue_order_id, client_order_id) {
            (Some(vid), _) => vid,
            (None, Some(cid)) => {
                // Fall back to batched query when only the client order ID is known
                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)

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Verify the client_order_id was actually submitted to Coinbase and matches exactly (including any adapter prefixes).
  2. Confirm the API key targets the same CDP portfolio/keys the order was placed under.
  3. Check the order exists in the Coinbase web UI under Advanced Trade orders.
  4. Treat this as 'order unknown to venue' in reconciliation flows rather than retrying the query.

Example fix

// before
let report = client.request_order_status_report(account_id, Some(cid.clone()), None).await?;
// after (guard for unknown orders)
match client.request_order_status_report(account_id, Some(cid.clone()), None).await {
    Ok(r) => Ok(r),
    Err(e) if e.to_string().contains("No order found") => { tracing::warn!("unknown to venue: {cid}"); Ok(None) }
    Err(e) => Err(e),
}
Defensive patterns

Strategy: fallback

Validate before calling

// before querying, confirm the order was submitted via this adapter/portfolio:
anyhow::ensure!(submitted_order_ids.contains(cid), "order {cid} was never sent to Coinbase");

Try / catch

match client.request_order_status_report(account_id, Some(cid.clone()), None).await {
    Ok(r) => Some(r),
    Err(e) if e.to_string().contains("No order found") => { warn!("order unknown to venue: {cid}"); None }
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: Calling request_order_status_report(account_id, client_order_id, None) with a client_order_id Coinbase does not recognize: order never submitted, submitted via a different key/portfolio, truncated id, or order purged from history.

Common situations: Requesting reconciliation for orders placed before the adapter existed, using local client_order_ids that were never sent to the venue, wrong CDP portfolio/API key pair, or typos in the stored order id.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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