{"record":{"id":"10fb75909ffc9043","repo":"nautechsystems/nautilus_trader","slug":"ax-fills-page-length-page-len-exceeds-applied-li","errorCode":null,"errorMessage":"AX fills page length {page_len} exceeds applied limit {limit}","messagePattern":"AX fills page length (.+?) exceeds applied limit (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/architect_ax/src/http/client.rs","lineNumber":2235,"sourceCode":"        loop {\n            let response = self\n                .inner\n                .get_fills_page(&params)\n                .await\n                .map_err(|e| anyhow::anyhow!(e))?;\n            let page_len = response.fills.len();\n\n            anyhow::ensure!(\n                page_len <= PAGE_SIZE as usize,\n                \"AX fills page length {page_len} exceeds requested limit {PAGE_SIZE}\"\n            );\n\n            if let Some(limit) = response.limit {\n                anyhow::ensure!(\n                    (0..=PAGE_SIZE).contains(&limit),\n                    \"AX fills applied limit must be between 0 and {PAGE_SIZE}, was {limit}\"\n                );\n                anyhow::ensure!(\n                    page_len <= limit as usize,\n                    \"AX fills page length {page_len} exceeds applied limit {limit}\"\n                );\n            }\n\n            if let Some(total_count) = response.total_count {\n                anyhow::ensure!(\n                    total_count >= 0,\n                    \"AX fills total_count must be non-negative, was {total_count}\"\n                );\n\n                if let Some(expected) = expected_total {\n                    anyhow::ensure!(\n                        total_count == expected,\n                        \"AX fills total_count changed during pagination: expected {expected}, was {total_count}\"\n                    );\n                } else {\n                    expected_total = Some(total_count);","sourceCodeStart":2217,"sourceCodeEnd":2253,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/architect_ax/src/http/client.rs#L2217-L2253","documentation":"After validating the reported `limit`, the paginator checks that the number of fills actually returned in the page (`page_len`) does not exceed that applied limit. A page larger than the server's own declared limit means the server violated its paging contract, so the client aborts to avoid inconsistent pagination state.","triggerScenarios":"An AX fills page response where `response.limit` is Some(n) but `response.fills.len()` > n — i.e. the server returned more rows per page than its declared applied limit.","commonSituations":"Server-side paging bug after a deployment; duplicate rows inflated the page; the server ignored the requested limit and returned a full unbounded batch while echoing a smaller limit.","solutions":["Log the raw page: compare fills.len() against response.limit to confirm the server over-returned.","Lower the requested limit and retry; if the server still over-returns, report a pagination bug to the AX backend team.","Check for a recent AX API version change and pin or upgrade the client accordingly.","If a proxy/cache is involved, bypass it and call the AX endpoint directly."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match client.paginate_fills(params).await {\n    Ok(fills) => apply(fills),\n    Err(e) if e.to_string().contains(\"exceeds applied limit\") => {\n        warn!(\"AX server over-returned page; retrying with smaller limit\");\n        retry_with_limit(params.limit.unwrap_or(PAGE_SIZE) / 2);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Request conservative limits (e.g. half of PAGE_SIZE) to leave server headroom.","Upgrade client/server versions together.","Bypass caches/proxies when validating pagination behavior."],"tags":["rust","pagination","validation","http-client"],"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-14T00:17:10.932Z"}