{"record":{"id":"494db1c8ef00e051","repo":"nautechsystems/nautilus_trader","slug":"failed-to-parse-lighter-active-order-for-acknow","errorCode":null,"errorMessage":"failed to parse Lighter active order {} for acknowledged create","messagePattern":"failed to parse Lighter active order (.+?) for acknowledged create","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/websocket/dispatch.rs","lineNumber":1769,"sourceCode":"        .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);\n    };\n    anyhow::ensure!(\n        matches.next().is_none(),\n        \"ambiguous Lighter active-order lookup for client_order_index {client_order_index} and nonce {nonce}\",\n    );\n\n    let report = parse_http_order_to_report(order, registry, account_id, clock.get_time_ns())\n        .ok_or_else(|| {\n            anyhow::anyhow!(\n                \"failed to parse Lighter active order {} for acknowledged create\",\n                order.order_index,\n            )\n        })?;\n    let report = dispatch\n        .translate_order_cloid(report)\n        .with_client_order_id(client_order_id);\n    Ok(Some(dispatch.preserve_pending_order_status(report)))\n}\n\n/// Look up a single order via the active and inactive HTTP endpoints, returning\n/// the corresponding [`OrderStatusReport`] if found.\n///\n/// Resolution order: explicit `venue_order_id` > cached `venue_id_map` >\n/// derived `client_order_index` from `dispatch.derive_client_order_index`.\n/// The third path is active-order only. It makes `query_order` work between\n/// submission and the venue's first `account_*` ack, while avoiding ambiguous\n/// terminal history where Lighter can reuse client indexes.","sourceCodeStart":1751,"sourceCodeEnd":1787,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/websocket/dispatch.rs#L1751-L1787","documentation":"The single active order matched during reconciliation could not be converted into a Nautilus OrderStatusReport by parse_http_order_to_report (e.g. its instrument or price data cannot be mapped to a registered instrument). The adapter refuses to emit a create-acknowledgement from an unparseable venue order.","triggerScenarios":"Reconciling an acknowledged create where the matching Lighter order's fields (instrument_id, prices, lot/tick mapping) fail to parse against the instrument registry — e.g. order references a market not in the registry or has NaN/zero fields the parser rejects.","commonSituations":"Instrument provider not fully loaded/initialized before reconciliation; venue order on a newly listed market missing from the local registry; stale instruments cache after venue changes.","solutions":["Ensure the instrument provider has loaded all markets before reconciliation (initialize instruments first).","Log the raw order JSON and extend parse_http_order_to_report to handle the offending field values.","Refresh/rebuild the instrument registry if markets changed on the venue."],"exampleFix":"// before: reconcile before instruments are loaded\n// after\nlet _ = ws.instruments_cache_ready().await; // wait for instrument provider initialization before lookup_active_order","handlingStrategy":"try-catch","validationCode":"if registry.market_index(&instrument_id).is_none() { return Err(\"instrument not registered\"); }","typeGuard":null,"tryCatchPattern":"match result { Err(e) if e.to_string().contains(\"failed to parse Lighter active order\") => { /* refresh instruments and retry */ }, other => other? }","preventionTips":["Initialize the instrument provider before reconciliation","Refresh instruments when the venue lists new markets","Log raw order payloads for parser debugging"],"tags":["parsing","reconciliation","instrument-registry"],"backgroundTag":"unexpected-api-response-shape","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"}