{"record":{"id":"02e2ef6056cb6033","repo":"nautechsystems/nautilus_trader","slug":"no-lighter-market-index-registered-for-instrument","errorCode":null,"errorMessage":"No Lighter market_index registered for {instrument_id}","messagePattern":"No Lighter market_index registered for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/data/mod.rs","lineNumber":795,"sourceCode":"    }\n\n    fn perp_market_stats_channel(\n        &self,\n        instrument_id: InstrumentId,\n        label: &str,\n    ) -> anyhow::Result<LighterWsChannel> {\n        let instrument = self\n            .instruments\n            .get_cloned(&instrument_id)\n            .ok_or_else(|| InstrumentLookupError::not_found(instrument_id))?;\n\n        anyhow::ensure!(\n            matches!(instrument, InstrumentAny::CryptoPerpetual(_)),\n            \"Lighter {label} subscriptions require a perpetual instrument: {instrument_id}\",\n        );\n\n        let market_index = self.registry.market_index(&instrument_id).ok_or_else(|| {\n            anyhow::anyhow!(\"No Lighter market_index registered for {instrument_id}\")\n        })?;\n\n        Ok(LighterWsChannel::MarketStats(\n            LighterMarketSelection::Market(market_index),\n        ))\n    }\n\n    fn index_market_stats_channel(\n        &self,\n        instrument_id: InstrumentId,\n    ) -> anyhow::Result<LighterWsChannel> {\n        let instrument = self\n            .instruments\n            .get_cloned(&instrument_id)\n            .ok_or_else(|| InstrumentLookupError::not_found(instrument_id))?;\n        let market_index = self.registry.market_index(&instrument_id).ok_or_else(|| {\n            anyhow::anyhow!(\"No Lighter market_index registered for {instrument_id}\")\n        })?;","sourceCodeStart":777,"sourceCodeEnd":813,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/data/mod.rs#L777-L813","documentation":"perp_market_stats_channel looks up the instrument's Lighter market_index in the adapter's registry after confirming it is a perpetual. If the registry has no market index registered for that InstrumentId, the channel cannot be built and this error is raised.","triggerScenarios":"Calling subscribe_mark_prices or subscribe_funding_rates for an instrument that exists in the instrument cache but was never registered with a Lighter market_index — e.g. the instrument was loaded outside the Lighter adapter's initialization or the registry was not populated for that market.","commonSituations":"Subscribing to an instrument from another venue or an instrument injected manually into the cache; adapter initialization that skipped instrument registration for some markets; a typo'd instrument ID that happens to match a cached instrument without registry entry.","solutions":["Ensure the Lighter adapter's instrument loading/registration ran so every tradable perp has a market_index in the registry.","Verify the InstrumentId's venue and symbol actually belong to the Lighter adapter.","Reconnect/re-initialize the data client to rebuild the registry if it appears incomplete."],"exampleFix":"// before\n// subscribing before adapter instruments were registered\nawait data_engine.subscribe_funding_rates(instrument_id)\n// after\nawait lighter_data_client.connect(); // loads and registers instruments + market indices\nawait data_engine.subscribe_funding_rates(instrument_id)","handlingStrategy":"validation","validationCode":"let idx = registry.market_index(&instrument_id);\nif idx.is_none() {\n    return Err(anyhow::anyhow!(\"{instrument_id} not registered with Lighter\"));\n}","typeGuard":"fn registered(registry: &MarketRegistry, id: &InstrumentId) -> bool { registry.market_index(id).is_some() }","tryCatchPattern":"match subscribe_mark_prices(instrument_id) {\n    Err(e) if e.to_string().contains(\"market_index registered\") => {\n        warn!(\"re-initializing Lighter client to register instruments\");\n        client.reconnect().await?;\n        client.subscribe_mark_prices(instrument_id).await\n    }\n    other => other,\n}","preventionTips":["Complete the adapter's connect/instrument-load step before subscribing to data channels","Only subscribe to InstrumentIds under the LIGHTER venue that the adapter itself loaded","On startup, verify every desired instrument has a registry entry before enabling subscriptions"],"tags":["subscription","registry","instrument","lighter"],"backgroundTag":"record-not-found","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}