{"record":{"id":"43ffca97266dc42d","repo":"nautechsystems/nautilus_trader","slug":"ax-open-orders-pagination-did-not-return-the-adver","errorCode":null,"errorMessage":"AX open-orders pagination did not return the advertised number of unique orders","messagePattern":"AX open-orders pagination did not return the advertised number of unique orders","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/architect_ax/src/http/client.rs","lineNumber":2064,"sourceCode":"            );\n\n            for order in response.orders {\n                anyhow::ensure!(\n                    seen_order_ids.insert(order.oid.clone()),\n                    \"AX open-orders pagination returned duplicate order ID {}\",\n                    order.oid\n                );\n                orders.push(order);\n            }\n\n            if next_offset == total_count {\n                break;\n            }\n\n            offset = next_offset;\n        }\n\n        anyhow::ensure!(\n            i64::try_from(orders.len()).context(\"AX open-orders result length exceeds i64\")?\n                == expected_total.unwrap_or_default(),\n            \"AX open-orders pagination did not return the advertised number of unique orders\"\n        );\n\n        let ts_init = self.generate_ts_init();\n        let mut reports = Vec::with_capacity(orders.len());\n\n        for order in &orders {\n            let instrument = self.resolve_report_instrument(order.s).await?;\n\n            match parse_order_status_report(\n                order,\n                account_id,\n                &instrument,\n                ts_init,\n                cid_resolver.as_ref(),\n            ) {","sourceCodeStart":2046,"sourceCodeEnd":2082,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/architect_ax/src/http/client.rs#L2046-L2082","documentation":"Final consistency check of the open-orders pagination: the number of unique collected orders must equal the total_count advertised on the first page (or 0 if no page was fetched). Any shortfall or surplus means the snapshot is incomplete or the server miscounted, so the client errors instead of returning partial data.","triggerScenarios":"After all pages are consumed, orders.len() != expected_total — e.g. rows vanished mid-pagination, totals were inflated, or dedup removed repeats.","commonSituations":"High-churn accounts where orders fill/cancel during the poll; venue total_count computed at a different instant than row serving; adapter/venue API drift.","solutions":["Retry the whole pagination loop to get a matching snapshot","Poll during lower activity or increase page size to reduce pages needed","Compare raw page counts vs total to determine whether server totals or rows are wrong","Report persistent mismatches to the venue/adapter maintainers"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if unique_orders.len() as i64 != advertised_total {\n    return Err(anyhow!(\"snapshot mismatch: {} unique vs {} advertised\",\n        unique_orders.len(), advertised_total));\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"did not return the advertised number\") => {\n        warn!(\"AX snapshot inconsistent; retrying full pagination\");\n        restart_pagination()\n    }\n    other => other,\n}","preventionTips":["Retry the whole pagination loop when totals don't reconcile","Poll during quiet periods or with larger pages to finish quickly","Track mismatch frequency; persistent failures indicate a venue-side bug worth reporting"],"tags":["pagination","consistency","http"],"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"}