nautechsystems/nautilus_trader · error
No order returned {context}
Error message
No order returned {context} What it means
After submitting an order or querying order status, the adapter takes the first item from Bybit's `result.list`. If Bybit acknowledges the request but returns an empty list, the adapter cannot construct an order report and throws this error with extra context.
Source
Thrown at crates/adapters/bybit/src/http/client.rs:4869
endpoint: &str,
context: &str,
) -> anyhow::Result<BybitOrder> {
let mut query_params = BybitOpenOrdersParamsBuilder::default();
query_params.category(product_type);
query_params.order_id(order_id.to_string());
let query_params = query_params.build().build_anyhow()?;
let order_response: BybitOpenOrdersResponse = self
.inner
.send_request(Method::GET, endpoint, Some(&query_params), None, true)
.await?;
order_response
.result
.list
.into_iter()
.next()
.ok_or_else(|| anyhow::anyhow!("No order returned {context}"))
}
}
#[cfg(test)]
mod tests {
use rstest::rstest;
use super::*;
#[rstest]
fn test_client_creation() {
let client = BybitHttpClient::new(None, 60, 3, 1000, 10_000, 5_000, None);
assert!(client.is_ok());
let client = client.unwrap();
assert!(client.base_url().contains("bybit.com"));
assert!(client.credential().is_none());
}View on GitHub (pinned to 18893faf8b)
Solutions
- Verify the orderId/orderLinkId and symbol match an existing order on that account
- Poll again shortly after submission — orders may be momentarily absent from query results during high throughput
- Rely on the WebSocket order stream for terminal states instead of immediate REST re-query
- Check `retCode`/`retMsg` in the raw response for an upstream rejection
Example fix
// before
let order = order_response.result.list.into_iter().next()
.ok_or_else(|| anyhow::anyhow!("No order returned {context}"))?;
// after: retry once before failing
let order = order_response.result.list.into_iter().next()
.or_else(|| poll_order_once(context))
.ok_or_else(|| anyhow::anyhow!("No order returned {context}"))?; Defensive patterns
Strategy: retry
Try / catch
match res { Err(e) if e.to_string().contains("No order returned") => {
tokio::time::sleep(Duration::from_millis(250)).await;
query_order_status_once_more(context)
} other => other } Prevention
- Wait for the WebSocket order stream to confirm terminal states instead of immediate REST re-query
- Keep the orderLinkId you generated so lookups are deterministic
- Don't query an order after it has been cancelled and purged
When it happens
Trigger: Calling submit_order or request_order_status where the Bybit v5 response `result.list` is empty — e.g. order already filled/cancelled and purged, or wrong orderId/orderLinkId queried.
Common situations: Querying an orderLinkId that was never registered; racing a cancel that removed the order before the status query; symbol/account mismatch so the order isn't visible.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- No wallet balance found in response
- No margin data returned from BitMEX
- Order missing ord_status and cannot infer (order_id={}, clie
- Either client_order_id or venue_order_id is required
- generate_order_status_report requires venue_order_id
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/52e8a5ed7c3e9b9e.
Report an issue: GitHub.