nautechsystems/nautilus_trader · error
Lighter order lookup requires an instrument_id (per-market R
Error message
Lighter order lookup requires an instrument_id (per-market REST query)
What it means
Lighter's REST order-status query is per-market, so the lookup needs a Nautilus instrument_id to derive the market_index. Calling the order-lookup/reconciliation path without an instrument_id is rejected rather than falling back to a venue-wide (nonexistent) query.
Source
Thrown at crates/adapters/lighter/src/websocket/dispatch.rs:1804
/// submission and the venue's first `account_*` ack, while avoiding ambiguous
/// terminal history where Lighter can reuse client indexes.
#[expect(
clippy::too_many_arguments,
reason = "order lookup threads context to the parser without a wrapper struct"
)]
pub(crate) async fn lookup_order_status_report(
http_client: &LighterHttpClient,
registry: &Arc<MarketRegistry>,
credential: &Credential,
account_id: AccountId,
instrument_id: Option<InstrumentId>,
client_order_id: Option<&ClientOrderId>,
venue_order_id: Option<&VenueOrderId>,
dispatch: &WsDispatchState,
clock: &'static AtomicTime,
) -> anyhow::Result<Option<OrderStatusReport>> {
let instrument_id = instrument_id.ok_or_else(|| {
anyhow::anyhow!("Lighter order lookup requires an instrument_id (per-market REST query)")
})?;
let market_index = registry
.market_index(&instrument_id)
.ok_or_else(|| anyhow::anyhow!("no Lighter market_index for instrument {instrument_id}"))?;
// Try, in order: explicit voi, cached voi, derived client_order_index.
let target_venue_index: Option<i64> = venue_order_id
.and_then(|voi| voi.as_str().parse::<i64>().ok())
.or_else(|| {
client_order_id
.and_then(|cloid| dispatch.lookup_venue_order_id(cloid))
.and_then(|voi| voi.as_str().parse::<i64>().ok())
});
let target_client_index: Option<i64> = client_order_id.map(|cloid| {
dispatch
.client_order_index(cloid)
.unwrap_or_else(|| dispatch.derive_client_order_index(cloid))
});View on GitHub (pinned to 18893faf8b)
Solutions
- Always supply instrument_id in the order status request (OrdersQuery/OrderStatus with instrument_id set).
- If only the venue_order_id is known, look up the order's instrument first, then retry the query.
- Skip per-order lookup for requests lacking instrument_id instead of calling this per-market REST path.
Example fix
// before client.query_order(None, Some(&voi), ...) // after client.query_order(Some(instrument_id), Some(&voi), ...)
Defensive patterns
Strategy: validation
Validate before calling
anyhow::ensure!(instrument_id.is_some(), "order lookup requires instrument_id");
Prevention
- Always include instrument_id in OrderStatus/OrdersQuery commands
- Resolve the order's instrument before per-market REST lookups
When it happens
Trigger: Invoking query_order (or reconciliation) with instrument_id=None — e.g. order status requests built from client_order_id or venue_order_id alone.
Common situations: Requesting an order status from a generic OrderStatus command that does not carry an instrument_id; reconciliation of orders whose instrument was not recorded.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Either venue_order_id or client_order_id must be provided
- Either client_order_id or venue_order_id must be provided
- Either client_order_ids or venue_order_ids must be provided
- Either venue_order_id or client_order_id must be provided
- Funding rates not available for {product_type} instruments
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/e29479396bd4e176.
Report an issue: GitHub.