{"record":{"id":"962a24f6e331c90f","repo":"nautechsystems/nautilus_trader","slug":"no-lighter-market-index-for-position-report-instru","errorCode":null,"errorMessage":"no Lighter market_index for position report instrument {instrument_id}","messagePattern":"no Lighter market_index for position report instrument (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/execution.rs","lineNumber":5192,"sourceCode":"            );\n            Ok((Vec::new(), false))\n        }\n    }\n}\n\nimpl LighterExecutionClient {\n    fn cached_position_reports(\n        &self,\n        cmd: &GeneratePositionStatusReports,\n    ) -> anyhow::Result<(Vec<PositionStatusReport>, bool, Option<AHashSet<i16>>)> {\n        // Lighter has no REST position source. The latest complete WebSocket\n        // snapshot is authoritative, while a skipped row keeps the retained\n        // cache available only as explicitly incomplete mass-status data.\n        let (mut reports, coverage) = self.dispatch.snapshot_positions_with_coverage();\n        let complete = match cmd.instrument_id {\n            Some(instrument_id) => {\n                let market_id = self.registry.market_index(&instrument_id).ok_or_else(|| {\n                    anyhow::anyhow!(\n                        \"no Lighter market_index for position report instrument {instrument_id}\",\n                    )\n                })?;\n                reports.retain(|report| report.instrument_id == instrument_id);\n                coverage\n                    .as_ref()\n                    .is_some_and(|skipped| !skipped.contains(&market_id))\n            }\n            None => coverage.as_ref().is_some_and(|skipped| skipped.is_empty()),\n        };\n        Ok((reports, complete, coverage))\n    }\n\n    async fn paginate_fill_reports(&self, cmd: &GenerateFillReports) -> anyhow::Result<FillSweep> {\n        let Some(credential) = &self.credential else {\n            log::warn!(\"Lighter generate_fill_reports: no credentials\");\n            return Ok(FillSweep {\n                reports: Vec::new(),","sourceCodeStart":5174,"sourceCodeEnd":5210,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/execution.rs#L5174-L5210","documentation":"When a position status report is requested for a specific instrument, the adapter must map the instrument_id to a Lighter market_index via the local registry. If the registry has no market index for that instrument, the mapping (and thus the query) cannot be built and the error is raised. This means the instrument was never registered/loaded into the Lighter instrument registry.","triggerScenarios":"Calling generate_position_status_reports with cmd.instrument_id = Some(id) where id was not registered by the adapter's instrument loading (e.g. an instrument from a different venue, a stale instrument ID, or subscription/config listing an instrument the adapter never fetched).","commonSituations":"Reconciliation configured with instruments from another venue or a renamed/migrated instrument ID; requesting reports for an instrument added after the registry was built; typo in instrument ID in config.","solutions":["Ensure the instrument is loaded into the Lighter registry before requesting position reports (add it to the adapter's configured instruments and re-initialize).","Verify the instrument_id is a Lighter instrument and matches the exact venue/symbol format.","Reload or rebuild the registry so market_index mappings are current, then retry.","If the instrument is genuinely unsupported, remove it from the reconciliation scope."],"exampleFix":"// before\nlet market_id = self.registry.market_index(&instrument_id).ok_or_else(|| {\n    anyhow::anyhow!(\"no Lighter market_index for position report instrument {instrument_id}\")\n})?;\n// after\nlet market_id = match self.registry.market_index(&instrument_id) {\n    Some(idx) => idx,\n    None => {\n        self.reload_registry_for(&instrument_id).await?;\n        self.registry.market_index(&instrument_id).ok_or_else(|| {\n            anyhow::anyhow!(\"no Lighter market_index for position report instrument {instrument_id}\")\n        })?\n    }\n};","handlingStrategy":"validation","validationCode":"if registry.market_index(&instrument_id).is_none() {\n    // register the instrument or drop it from scope before requesting reports\n}","typeGuard":"fn is_lighter_instrument(registry: &Registry, id: &InstrumentId) -> bool { registry.market_index(id).is_some() }","tryCatchPattern":"match res {\n    Err(e) if e.to_string().contains(\"no Lighter market_index for position report\") => load_instrument_then_retry(id),\n    other => other,\n}","preventionTips":["Always load instruments into the Lighter registry before any report requests","Validate instrument IDs against the registry at config time","Keep instrument IDs consistent across venues; never mix venue symbols"],"tags":["lighter","instrument-registry","mapping","reconciliation"],"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-14T00:17:10.932Z"}