{"record":{"id":"d8776fad48026dc2","repo":"nautechsystems/nautilus_trader","slug":"no-lighter-market-index-for-instrument-instrument","errorCode":null,"errorMessage":"no Lighter market_index for instrument {instrument_id}","messagePattern":"no Lighter market_index for instrument (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/websocket/dispatch.rs","lineNumber":1742,"sourceCode":"#[expect(\n    clippy::too_many_arguments,\n    reason = \"exact create identity and report context cross the REST translation boundary\"\n)]\npub(crate) async fn lookup_create_order_status_report(\n    http_client: &LighterHttpClient,\n    registry: &Arc<MarketRegistry>,\n    credential: &Credential,\n    account_id: AccountId,\n    instrument_id: InstrumentId,\n    client_order_id: ClientOrderId,\n    client_order_index: i64,\n    nonce: i64,\n    dispatch: &WsDispatchState,\n    clock: &'static AtomicTime,\n) -> anyhow::Result<Option<OrderStatusReport>> {\n    let market_index = registry\n        .market_index(&instrument_id)\n        .ok_or_else(|| anyhow::anyhow!(\"no Lighter market_index for instrument {instrument_id}\"))?;\n    let auth = mint_auth_token(credential)?;\n    let query = Zeroizing::new(LighterAccountActiveOrdersQuery {\n        authorization: None,\n        auth: Some(auth.clone()),\n        account_index: credential.account_index(),\n        market_id: market_index,\n    });\n    let active = http_client\n        .get_account_active_orders(&query)\n        .await\n        .context(\"failed to fetch Lighter active orders\")?;\n\n    let mut matches = active\n        .orders\n        .iter()\n        .filter(|order| order.client_order_index == client_order_index && order.nonce == nonce);\n    let Some(order) = matches.next() else {\n        return Ok(None);","sourceCodeStart":1724,"sourceCodeEnd":1760,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/websocket/dispatch.rs#L1724-L1760","documentation":"Before querying account active orders, the handler resolves the instrument_id to a Lighter market_index via the local registry. If the registry has no entry, it returns this error — the adapter cannot query per-market without the numeric market index.","triggerScenarios":"Requesting order status reports for an instrument_id that was never registered/loaded into the instrument registry (e.g. wrong instrument_id string, universe not initialized, or instrument added on venue after adapter startup).","commonSituations":"Typo'd or wrong-venue instrument IDs, subscribing before instruments were loaded, new market listed after adapter start.","solutions":["Verify the instrument_id exactly matches one loaded into the adapter's registry","Reload/refresh the instrument registry and retry","Confirm the instrument exists on Lighter and the adapter was configured for it"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"let market_index = registry.market_index(&instrument_id);\nif market_index.is_none() {\n    return Err(anyhow!(\"instrument {instrument_id} not registered; load instruments first\"));\n}","typeGuard":"fn registered(reg: &Registry, id: InstrumentId) -> Option<i64> { reg.market_index(&id) }","tryCatchPattern":"match build_order_status_report(instrument_id, ...).await {\n    Ok(r) => r,\n    Err(e) if e.to_string().contains(\"no Lighter market_index\") => {\n        reload_instrument_registry().await?;\n        retry_report().await;\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Load/refresh the instrument universe before issuing per-instrument queries","Validate instrument_id strings against the loaded registry at config time","Handle newly listed markets by reloading the registry instead of restarting"],"tags":["rust","instrument","lookup","registry"],"backgroundTag":"entity-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"}