{"record":{"id":"7743af827145a4c1","repo":"nautechsystems/nautilus_trader","slug":"lighter-active-market-seed-exceeded-max-reconcili","errorCode":null,"errorMessage":"Lighter active-market seed exceeded {MAX_RECONCILIATION_PAGES} pages","messagePattern":"Lighter active-market seed exceeded (.+?) pages","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/execution.rs","lineNumber":5566,"sourceCode":"            | OrderType::LimitIfTouched\n    )\n}\n\nasync fn seed_active_markets_from_inactive_orders(\n    http_client: &LighterHttpClient,\n    dispatch: &WsDispatchState,\n    credential: &Credential,\n    auth: &SecretString,\n    between_timestamps: Option<String>,\n) -> anyhow::Result<()> {\n    let mut cursor: Option<String> = None;\n    let mut seen_cursors = AHashSet::new();\n    let mut orders_seen = 0_usize;\n    let mut pages = 0_usize;\n\n    loop {\n        pages += 1;\n        anyhow::ensure!(\n            pages <= MAX_RECONCILIATION_PAGES,\n            \"Lighter active-market seed exceeded {MAX_RECONCILIATION_PAGES} pages\",\n        );\n        let query = Zeroizing::new(LighterAccountInactiveOrdersQuery {\n            authorization: None,\n            auth: Some(auth.clone()),\n            account_index: credential.account_index(),\n            market_id: None,\n            ask_filter: None,\n            between_timestamps: between_timestamps.clone(),\n            cursor: cursor.clone(),\n            limit: LIGHTER_REST_PAGE_SIZE,\n        });\n        let response = http_client\n            .get_account_inactive_orders(&query)\n            .await\n            .context(\"failed to seed Lighter active markets from inactive orders\")?;\n","sourceCodeStart":5548,"sourceCodeEnd":5584,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/execution.rs#L5548-L5584","documentation":"The active-market seed routine pages through a Lighter account's inactive orders to discover which markets are active. Pagination is capped at MAX_RECONCILIATION_PAGES; exceeding the cap aborts with this error to prevent unbounded looping while seeding.","triggerScenarios":"An account with more historical inactive orders than can be paginated within MAX_RECONCILIATION_PAGES, or a cursor stream from LighterAccountInactiveOrdersQuery that never terminates.","commonSituations":"Long-lived accounts with very large order history being seeded for the first time; exchange cursor anomalies.","solutions":["Re-run seeding periodically so accumulated inactive orders fit within the cap.","Purge or archive old orders on the account if possible, or use a dedicated account for testing with less history.","Verify Lighter API cursor behavior; a non-terminating stream indicates an exchange issue.","Raise MAX_RECONCILIATION_PAGES in the adapter if the account legitimately needs more pages."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if account_inactive_order_estimate() > MAX_RECONCILIATION_PAGES * PAGE_SIZE {\n    // archive history or raise the cap before seeding\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = seed_active_markets().await {\n    if e.to_string().contains(\"active-market seed exceeded\") { seed_in_batches().await?; }\n}","preventionTips":["Seed regularly so inactive-order history stays small","Avoid using long-lived high-churn accounts for seeding-heavy workflows","Raise the page cap deliberately if the account legitimately needs more pages"],"tags":["pagination","seeding","lighter","orders"],"backgroundTag":"pagination-limit-exceeded","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"}