{"record":{"id":"19d757fbf38dad10","repo":"nautechsystems/nautilus_trader","slug":"no-lighter-market-index-registered-for-instrument-19d757","errorCode":null,"errorMessage":"no Lighter market_index registered for instrument {}","messagePattern":"no Lighter market_index registered for instrument (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/execution.rs","lineNumber":1780,"sourceCode":"                .send_cancel_order(prepared, emit_cancel_rejected)\n                .await;\n            Ok(())\n        });\n    }\n\n    fn can_emit_order_cancel_rejected(&self, client_order_id: &ClientOrderId) -> bool {\n        self.core\n            .cache()\n            .order(client_order_id)\n            .is_none_or(|order| order.is_pending_cancel())\n    }\n\n    fn prepare_cancel_order_plan(&self, cmd: &CancelOrder) -> anyhow::Result<CancelOrderPlan> {\n        let market_index = self\n            .registry\n            .market_index(&cmd.instrument_id)\n            .ok_or_else(|| {\n                anyhow::anyhow!(\n                    \"no Lighter market_index registered for instrument {}\",\n                    cmd.instrument_id,\n                )\n            })?;\n\n        self.core.cache().try_order(&cmd.client_order_id)?;\n\n        // Lighter cancel_order targets a single order by venue order_id.\n        // The map is populated on the first OrderStatusReport for the cloid.\n        let voi = cmd\n            .venue_order_id\n            .or_else(|| self.dispatch.lookup_venue_order_id(&cmd.client_order_id))\n            .ok_or_else(|| {\n                anyhow::anyhow!(\n                    \"cannot cancel Lighter order {}: venue order_id not yet known \\\n                     (await OrderAccepted before issuing cancel)\",\n                    cmd.client_order_id,\n                )","sourceCodeStart":1762,"sourceCodeEnd":1798,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/execution.rs#L1762-L1798","documentation":"prepare_cancel_order_plan could not resolve the CancelOrder command's instrument_id to a Lighter market_index in the registry. Cancels are sent per Lighter market index, so without that mapping the cancel cannot be signed.","triggerScenarios":"dispatch_signed_cancel_order or batch_cancel_orders with a CancelOrder for an instrument never registered with the adapter (unknown symbol, wrong venue, instruments not loaded).","commonSituations":"Canceling orders after switching configuration to different markets; strategy holding stale instrument_ids from a previous session; instrument registration failed at startup; canceling cross-venue by mistake.","solutions":["Verify the instrument_id matches a registered Lighter instrument and fix the symbol/venue.","Confirm instruments were loaded/registered at startup before any cancel is issued.","Filter the strategy's cancel logic to only instruments present in the registry.","Check startup logs for instrument load failures."],"exampleFix":"// before\nlet cmd = CancelOrder::new(instrument_id_unknown, client_order_id, None);\n// after\nif registry.market_index(&instrument_id_unknown).is_some() {\n    let cmd = CancelOrder::new(instrument_id_unknown, client_order_id, None);\n    execution.cancel_order(cmd)?;\n}","handlingStrategy":"validation","validationCode":"// Rust\nif registry.market_index(&cmd.instrument_id).is_none() {\n    log::warn!(\"skipping cancel for unregistered instrument {}\", cmd.instrument_id);\n    return Ok(());\n}","typeGuard":null,"tryCatchPattern":"match adapter.cancel_order(cmd) {\n    Err(e) if e.to_string().contains(\"no Lighter market_index registered\") => {\n        log::error!(\"cancel for unknown instrument {}\", cmd.instrument_id);\n        Ok(()) // or surface, depending on policy\n    }\n    other => other,\n}","preventionTips":["Derive cancel targets from the adapter's own open-order state, not external ids","Validate instrument ids at strategy construction time","Confirm instruments loaded before enabling cancel/flatten logic"],"tags":["instrument","registry","cancel","trading"],"backgroundTag":"resource-not-found","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}