{"record":{"id":"41231cabca703862","repo":"nautechsystems/nautilus_trader","slug":"trades-request-failed-for-instrument-id","errorCode":null,"errorMessage":"trades request failed for {instrument_id}","messagePattern":"trades request failed for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/hyperliquid/src/data.rs","lineNumber":1326,"sourceCode":"        let limit = request.limit.map(|n| n.get());\n        let start_nanos = datetime_to_unix_nanos(request.start);\n        let end_nanos = datetime_to_unix_nanos(request.end);\n\n        self.spawn_task(\"request_trades\", async move {\n            // `recentTrades` depends on the Hyperliquid indexer; nodes without it\n            // return HTTP 422. Treat that as \"no coverage\" and serve an empty\n            // response so the awaiting caller still completes.\n            let raw_trades = match http.info_recent_trades(&coin).await {\n                Ok(trades) => trades,\n                Err(e) if e.is_unprocessable_entity() => {\n                    log::warn!(\n                        \"Recent trades endpoint unavailable for {instrument_id} \\\n                         (requires the Hyperliquid indexer); sending empty response\"\n                    );\n                    Vec::new()\n                }\n                Err(e) => {\n                    return Err(anyhow::Error::new(e))\n                        .with_context(|| format!(\"trades request failed for {instrument_id}\"));\n                }\n            };\n\n            let mut trades: Vec<TradeTick> = Vec::with_capacity(raw_trades.len());\n            for raw in &raw_trades {\n                match parse_recent_trade(raw, &instrument) {\n                    Ok(trade) => trades.push(trade),\n                    Err(e) => log::warn!(\"Skipping recent trade for {instrument_id}: {e}\"),\n                }\n            }\n            trades.sort_by_key(|trade| trade.ts_event);\n\n            let trades = filter_recent_trades(trades, start_nanos, end_nanos, limit, instrument_id);\n\n            log::debug!(\"Fetched {} trades for {instrument_id}\", trades.len());\n\n            let response = DataResponse::Trades(TradesResponse::new(","sourceCodeStart":1308,"sourceCodeEnd":1344,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/hyperliquid/src/data.rs#L1308-L1344","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Validate the instrument before requesting trades\nif !data_client.instrument_provider().get(&instrument_id).is_ok() {\n    return Err(anyhow!(\"unknown Hyperliquid instrument: {instrument_id}\"));\n}","typeGuard":"fn is_trades_request_failure(err: &anyhow::Error) -> bool {\n    err.to_string().starts_with(\"trades request failed for \")\n}","tryCatchPattern":"match client.request_trades(&instrument_id).await {\n    Err(e) if is_trades_request_failure(&e) => {\n        retry_with_backoff(|| client.request_trades(&instrument_id)).await\n    }\n    other => other,\n}","preventionTips":["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"],"tags":["http","hyperliquid","trades","request"],"backgroundTag":"api-request-failed","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}