nautechsystems/nautilus_trader · error

no Lighter market_index registered for instrument {instrumen

Error message

no Lighter market_index registered for instrument {instrument_id}

What it means

prepare_create_order_plan could not find a Lighter market_index for the order's instrument_id in the adapter's instrument registry. The registry is populated when instruments are loaded/registered; submitting for an unregistered instrument is impossible because Lighter identifies markets by integer index.

Source

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

    ) -> anyhow::Result<()> {
        let context = self.fanout_dispatch_context(credential)?;
        let prepared = context.sign_create_order(plan)?;
        self.spawn_task("submit_order", async move {
            context.send_create_order(prepared).await;
            Ok(())
        });

        Ok(())
    }

    fn prepare_create_order_plan(
        &self,
        order: &OrderAny,
        slippage_bps: u32,
    ) -> anyhow::Result<CreateOrderPlan> {
        let instrument_id = order.instrument_id();
        let market_index = self.registry.market_index(&instrument_id).ok_or_else(|| {
            anyhow::anyhow!("no Lighter market_index registered for instrument {instrument_id}")
        })?;

        let instrument = self.core.cache().try_instrument(&instrument_id)?.clone();

        let order_kind = nautilus_to_lighter_order_type(order.order_type())?;

        let tif = nautilus_to_lighter_tif(
            order.order_type(),
            order.time_in_force(),
            order.is_post_only(),
        )?;
        let now_ms = (self.clock.get_time_ns().as_u64() / 1_000_000) as i64;
        let order_expiry = order_expiry_for(
            order.order_type(),
            &order.time_in_force(),
            order.expire_time(),
            now_ms,
        )?;

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Ensure the instrument is in the adapter's configured markets and that instruments were loaded before trading.
  2. Verify the instrument_id matches a registered Lighter instrument (venue/exchange prefix and symbol).
  3. Check adapter startup logs for instrument registration errors.
  4. Query the registry (or dump registered instruments) to confirm the exact symbol spelling.

Example fix

// before
let order = order_factory.market("LIGHTER-ETH-USDC", ...); // not configured
// after
let order = order_factory.market("ETH-USDC.LIGHTER", ...); // registered instrument id
Defensive patterns

Strategy: validation

Validate before calling

// Rust
anyhow::ensure!(
    registry.market_index(&order.instrument_id()).is_some(),
    "instrument {} not registered with Lighter",
    order.instrument_id()
);

Try / catch

match adapter.submit_order(order) {
    Err(e) if e.to_string().contains("no Lighter market_index registered") => {
        log::error!("unregistered instrument: check config/startup");
        Err(e)
    }
    other => other,
}

Prevention

When it happens

Trigger: submit_order or submit_order_list with an OrderAny whose instrument_id was never registered (e.g. instrument not in the configured markets, wrong venue prefix, or instruments not yet loaded).

Common situations: Typo or mismatch between configured Lighter markets and the instrument used in the strategy; submitting on a different venue than configured; starting the trader before instrument registration completes; stale cache after config change.

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