nautechsystems/nautilus_trader · error
trades request failed for {instrument_id}
Error message
trades request failed for {instrument_id} What it means
This error is returned by the Hyperliquid data client's request_trades when the HTTP request to fetch recent trades for an instrument fails (other than the handled "endpoint unavailable" case, which yields an empty response). The original transport/API error is the source; the context names the instrument_id involved. Callers of request_trades (e.g. the live data engine's request callback) receive this as the request failure.
Source
Thrown at crates/adapters/hyperliquid/src/data.rs:1326
let limit = request.limit.map(|n| n.get());
let start_nanos = datetime_to_unix_nanos(request.start);
let end_nanos = datetime_to_unix_nanos(request.end);
self.spawn_task("request_trades", async move {
// `recentTrades` depends on the Hyperliquid indexer; nodes without it
// return HTTP 422. Treat that as "no coverage" and serve an empty
// response so the awaiting caller still completes.
let raw_trades = match http.info_recent_trades(&coin).await {
Ok(trades) => trades,
Err(e) if e.is_unprocessable_entity() => {
log::warn!(
"Recent trades endpoint unavailable for {instrument_id} \
(requires the Hyperliquid indexer); sending empty response"
);
Vec::new()
}
Err(e) => {
return Err(anyhow::Error::new(e))
.with_context(|| format!("trades request failed for {instrument_id}"));
}
};
let mut trades: Vec<TradeTick> = Vec::with_capacity(raw_trades.len());
for raw in &raw_trades {
match parse_recent_trade(raw, &instrument) {
Ok(trade) => trades.push(trade),
Err(e) => log::warn!("Skipping recent trade for {instrument_id}: {e}"),
}
}
trades.sort_by_key(|trade| trade.ts_event);
let trades = filter_recent_trades(trades, start_nanos, end_nanos, limit, instrument_id);
log::debug!("Fetched {} trades for {instrument_id}", trades.len());
let response = DataResponse::Trades(TradesResponse::new(View on GitHub (pinned to 18893faf8b)
Solutions
- Check the chained source error for the HTTP/API failure detail
- Validate the instrument_id is a correct Hyperliquid venue symbol
- Retry the request — transient network/rate-limit issues often resolve
- Check Hyperliquid API status and rate-limit headers/backoff behavior
- Verify network/proxy connectivity to the Hyperliquid endpoint
Defensive patterns
Strategy: retry
Validate before calling
// Validate the instrument before requesting trades
if !data_client.instrument_provider().get(&instrument_id).is_ok() {
return Err(anyhow!("unknown Hyperliquid instrument: {instrument_id}"));
} Type guard
fn is_trades_request_failure(err: &anyhow::Error) -> bool {
err.to_string().starts_with("trades request failed for ")
} Try / catch
match client.request_trades(&instrument_id).await {
Err(e) if is_trades_request_failure(&e) => {
retry_with_backoff(|| client.request_trades(&instrument_id)).await
}
other => other,
} Prevention
- Validate instrument_ids against the provider catalog before requests
- Apply rate limiting/backoff on Hyperliquid HTTP calls
- Distinguish the handled "indexer unavailable" empty response from true failures in downstream code
- Monitor API status and network reachability from the trading host
When it happens
Trigger: Calling request_trades(instrument_id) on the Hyperliquid data client when the underlying HTTP GET to the trades endpoint returns a transport error, non-success status, or unhandled API error for that instrument.
Common situations: Hyperliquid API outage or rate limiting; invalid instrument_id not recognized by the venue; network/DNS failure from the trading host; indexer-side errors distinct from the explicitly-handled "unavailable" 404 path.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
- Hyperliquid does not provide historical market trades via HT
- Unsupported OrderType for conditional orders: {value:?}
- Binance Futures account state request failed: {e}
- Modify order failed: {e}
- invalid Binance Futures order-book depth; valid values are {
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/41231cabca703862.
Report an issue: GitHub.