nautechsystems/nautilus_trader · error

no Lighter market_index for fill instrument {instrument_id}

Error message

no Lighter market_index for fill instrument {instrument_id}

What it means

When generating fill (order status) reports filtered to a specific instrument, the adapter needs the Lighter market_index for that instrument to query the exchange. If the registry lookup fails, this error is raised because fills cannot be fetched for an unmapped instrument.

Source

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

            }
            None => coverage.as_ref().is_some_and(|skipped| skipped.is_empty()),
        };
        Ok((reports, complete, coverage))
    }

    async fn paginate_fill_reports(&self, cmd: &GenerateFillReports) -> anyhow::Result<FillSweep> {
        let Some(credential) = &self.credential else {
            log::warn!("Lighter generate_fill_reports: no credentials");
            return Ok(FillSweep {
                reports: Vec::new(),
                covers_window: true,
            });
        };

        let market_id = match cmd.instrument_id {
            Some(instrument_id) => {
                Some(self.registry.market_index(&instrument_id).ok_or_else(|| {
                    anyhow::anyhow!("no Lighter market_index for fill instrument {instrument_id}",)
                })?)
            }
            None => None,
        };

        let auth = build_auth_token_for(credential)
            .context("failed to mint Lighter auth token for fill fetch")?;

        let ts_init = self.clock.get_time_ns();
        let mut reports = Vec::new();
        let mut cursor: Option<String> = None;
        let mut seen_cursors = AHashSet::new();
        let mut seen_in_call = AHashSet::new();
        let mut pages = 0_usize;
        let mut oldest_served: Option<UnixNanos> = None;
        let mut covers_window = true;

        loop {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Register/load the instrument into the Lighter registry before running fill reconciliation.
  2. Confirm the instrument_id venue and symbol are exactly what the adapter registered.
  3. Rebuild/refresh the registry mapping, then retry the reconciliation.
  4. Drop the instrument from the requested scope if it is not traded on Lighter.

Example fix

// before
let market_id = self.registry.market_index(&instrument_id).ok_or_else(|| {
    anyhow::anyhow!("no Lighter market_index for fill instrument {instrument_id}")
})?;
// after
let market_id = self.registry.market_index(&instrument_id)
    .ok_or_else(|| anyhow::anyhow!(
        "no Lighter market_index for fill instrument {instrument_id}; registered instruments: {:?}",
        self.registry.registered_ids()
    ))?;
Defensive patterns

Strategy: validation

Validate before calling

let market_id = registry.market_index(&instrument_id)
    .ok_or_else(|| anyhow!("instrument {instrument_id} not registered with Lighter"))?;

Type guard

fn can_reconcile_fills(registry: &Registry, id: &InstrumentId) -> bool { registry.market_index(id).is_some() }

Try / catch

if let Err(e) = result {
    if e.to_string().contains("no Lighter market_index for fill") { register_and_retry(instrument_id)?; }
}

Prevention

When it happens

Trigger: Calling generate_order_status_reports (fill reconciliation) with cmd.instrument_id = Some(id) where the Lighter registry contains no market_index for that instrument_id — instrument never loaded, wrong venue, or stale ID.

Common situations: Fill reconciliation scoped to an instrument from a different adapter, an instrument whose market was delisted/changed on Lighter, or a misconfigured instrument ID in the reconciliation request.

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/79f072ebda89e433. Report an issue: GitHub.