nautechsystems/nautilus_trader · error

no Lighter market_index for order report instrument {id}

Error message

no Lighter market_index for order report instrument {id}

What it means

Raised when an order status/report request targets a specific instrument_id that has no market_index registered in the adapter's instrument registry. The adapter can only translate instrument IDs it has previously registered (via instrument discovery/subscription) into Lighter venue market indices.

Source

Thrown at crates/adapters/lighter/src/execution.rs:4667

        // position frames; if startup reconciliation reaches this path before
        // any market is known, one unscoped inactive-order page walk seeds it
        // from historical account activity.
        if cmd.instrument_id.is_none() && self.dispatch.active_markets_snapshot().is_empty() {
            seed_active_markets_from_inactive_orders(
                &self.http_client,
                &self.dispatch,
                credential,
                &auth,
                format_between_timestamps(cmd.start, cmd.end, ts_init),
            )
            .await?;
        }

        let market_indices = match cmd.instrument_id {
            Some(id) => match self.registry.market_index(&id) {
                Some(idx) => vec![idx],
                None => {
                    anyhow::bail!("no Lighter market_index for order report instrument {id}",);
                }
            },
            None => self.dispatch.active_markets_snapshot(),
        };

        if market_indices.is_empty() {
            log::debug!(
                "Lighter generate_order_status_reports: no active markets yet; returning empty",
            );
            Self::log_report_receipt(0, "OrderStatusReport", cmd.log_receipt_level);
            return Ok(Vec::new());
        }

        let mut reports: Vec<OrderStatusReport> = Vec::new();
        let mut active_errors = Vec::new();

        // Active orders are by definition still open. Returning them
        // unconditionally even when `cmd.start` is set: an open order's

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Use an instrument_id the client has registered (check the instruments loaded at startup)
  2. Wait for instrument initialization/subscription to complete before issuing report queries
  3. Correct the instrument ID spelling/venue prefix
  4. Subscribe to the market first so its market_index is added to the registry

Example fix

// before: query without verifying registration
client.order_report(Some(instrument_id)).await?;
// after: guard on registry membership first
if client.registry.market_index(&instrument_id).is_some() {
    client.order_report(Some(instrument_id)).await?;
} else {
    // fall back to querying all active markets
    client.order_report(None).await?;
}
Defensive patterns

Strategy: validation

Validate before calling

// Rust: check registry membership before querying
if execution.registry.market_index(&instrument_id).is_none() {
    // omit instrument_id to query all active markets instead
    return execution.order_report(None).await;
}

Try / catch

match execution.order_report(Some(instrument_id)).await {
    Err(e) if e.to_string().contains("no Lighter market_index") => {
        execution.order_report(None).await? // fallback: all active markets
    }
    r => r,
}

Prevention

When it happens

Trigger: Calling an order-report query with an instrument_id that was never subscribed/discovered on this client — a typo'd or foreign instrument ID, or querying before instruments were loaded.

Common situations: Copy-pasting an instrument ID from another venue or account, querying orders for a market the client never subscribed to, or racing instrument initialization at startup.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/b8ec9a686308a5a7. Report an issue: GitHub.