nautechsystems/nautilus_trader · error · anyhow::Error
Failed to fetch orders: {e}
Error message
Failed to fetch orders: {e} What it means
Raised by request_order_status_report when fetch_all_orders(&query) fails while looking up an order by venue_order_id (this branch). The REST error is wrapped so callers can distinguish fetch failure from 'order not found' (a separate error).
Source
Thrown at crates/adapters/coinbase/src/http/client.rs:1157
pub async fn request_order_status_report(
&self,
account_id: AccountId,
client_order_id: Option<ClientOrderId>,
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}"))?;View on GitHub (pinned to 18893faf8b)
Solutions
- Retry with backoff for 429/5xx responses from list_orders.
- Verify the API key has order-read (view) scope for the CDP portfolio.
- Check the venue_order_id format matches Coinbase's order id.
- Inspect the wrapped {e} for signing/clock-skew auth failures and resync NTP.
Example fix
// before
let report = client.request_order_status_report(account_id, None, Some(venue_order_id)).await?;
// after
for attempt in 0..3 {
match client.request_order_status_report(account_id, None, Some(venue_order_id.clone())).await {
Ok(r) => return Ok(r),
Err(e) if attempt < 2 => tokio::time::sleep(Duration::from_millis(500 * (attempt + 1))).await,
Err(e) => return Err(e),
}
} Defensive patterns
Strategy: retry
Validate before calling
anyhow::ensure!(!venue_order_id.as_str().is_empty(), "venue_order_id must be non-empty");
Try / catch
match client.request_order_status_report(account_id, None, Some(vid.clone())).await {
Ok(r) => r,
Err(e) if is_rate_limit(&e) => { sleep(rate_backoff).await; retry() }
Err(e) => return Err(e),
} Prevention
- Throttle order report requests to stay within Coinbase rate limits.
- Ensure API keys have order read scope.
- Store venue order ids exactly as returned by Coinbase.
When it happens
Trigger: Calling request_order_status_report with a venue_order_id where GET /orders/list_orders fails: auth errors, rate limits, malformed query params, network outage.
Common situations: Coinbase API rate limiting during heavy report generation, invalid API key scopes (orders read), pagination failures on large order sets, transient network drops on live servers.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- Failed to fetch products: {e}
- Failed to fetch product '{product_id}': {e}
- Unsupported TIF {time_in_force} for LIMIT on Coinbase
- Unsupported TIF {time_in_force} for STOP_LIMIT on Coinbase
- Unsupported order type for Coinbase: {other}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/a57872a6ab103f91.
Report an issue: GitHub.