{"record":{"id":"8f49d23b3624226a","repo":"nautechsystems/nautilus_trader","slug":"ax-open-orders-page-length-page-len-exceeds-appl","errorCode":null,"errorMessage":"AX open-orders page length {page_len} exceeds applied limit {}","messagePattern":"AX open-orders page length (.+?) exceeds applied limit (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/architect_ax/src/http/client.rs","lineNumber":2022,"sourceCode":"                \"AX open-orders applied limit must be between 0 and {PAGE_SIZE}, was {}\",\n                response.limit\n            );\n            anyhow::ensure!(\n                i64::from(response.offset) == offset,\n                \"AX open-orders response offset mismatch: requested {offset}, was {}\",\n                response.offset\n            );\n\n            let total_count = *expected_total.get_or_insert(response.total_count);\n            anyhow::ensure!(\n                response.total_count == total_count,\n                \"AX open-orders total_count changed during pagination: expected {total_count}, was {}\",\n                response.total_count\n            );\n\n            let page_len = i64::try_from(response.orders.len())\n                .context(\"AX open-orders page length exceeds i64\")?;\n            anyhow::ensure!(\n                page_len <= i64::from(response.limit),\n                \"AX open-orders page length {page_len} exceeds applied limit {}\",\n                response.limit\n            );\n            let next_offset = offset\n                .checked_add(page_len)\n                .context(\"AX open-orders offset overflow\")?;\n            anyhow::ensure!(\n                next_offset <= total_count,\n                \"AX open-orders page exceeds total_count: next offset {next_offset}, total {total_count}\"\n            );\n\n            if total_count == 0 {\n                anyhow::ensure!(\n                    response.orders.is_empty(),\n                    \"AX open-orders returned rows with total_count zero\"\n                );\n                break;","sourceCodeStart":2004,"sourceCodeEnd":2040,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/architect_ax/src/http/client.rs#L2004-L2040","documentation":"The AX API returned more order rows in a single page than the limit parameter that was applied to the request. The client validates that the server honors the requested page size before advancing the offset; a longer page would make offset arithmetic incorrect and silently skip or duplicate orders.","triggerScenarios":"A server-side bug, API version change, or misinterpreted limit parameter causes response.orders.len() to exceed response.limit on a page of the open-orders pagination.","commonSituations":"Adapter/venue version drift where limit semantics changed; proxy or gateway mangling query parameters; new API behavior not covered by the adapter's expectations.","solutions":["Verify the limit parameter actually sent in the request matches what the API expects","Check for an AX API version change and update the adapter","Log the raw response and report the contract violation to the venue/adapter maintainers","Cap page consumption client-side to the requested limit as a defensive measure"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if let Some(resp) = &last_response {\n    assert!(resp.orders.len() <= resp.limit as usize,\n        \"server returned {} rows for limit {}\", resp.orders.len(), resp.limit);\n}","typeGuard":"fn page_within_limit(page_len: usize, limit: i64) -> bool {\n    page_len <= limit as usize\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"exceeds applied limit\") => {\n        log::error!(\"AX API limit semantics changed; verify adapter version\");\n        Err(e)\n    }\n    other => other,\n}","preventionTips":["Keep the adapter version in sync with the AX API version you target","Log raw responses when limit-related errors appear to diagnose server behavior","Pin and verify the limit query parameter in request logs"],"tags":["pagination","http","contract-violation"],"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"}