{"record":{"id":"e64b635c0e16326f","repo":"nautechsystems/nautilus_trader","slug":"ax-fills-returned-an-empty-next-cursor","errorCode":null,"errorMessage":"AX fills returned an empty next_cursor","messagePattern":"AX fills returned an empty next_cursor","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/architect_ax/src/http/client.rs","lineNumber":2276,"sourceCode":"                anyhow::ensure!(\n                    seen_trade_ids.insert(fill.trade_id.clone()),\n                    \"AX fills pagination returned duplicate trade ID {}\",\n                    fill.trade_id\n                );\n                fills.push(fill);\n            }\n\n            if let Some(total_count) = expected_total {\n                anyhow::ensure!(\n                    fills.len() as i64 <= total_count,\n                    \"AX fills pagination returned more unique rows ({}) than total_count {total_count}\",\n                    fills.len()\n                );\n            }\n\n            match response.next_cursor {\n                Some(next_cursor) => {\n                    anyhow::ensure!(\n                        !next_cursor.is_empty(),\n                        \"AX fills returned an empty next_cursor\"\n                    );\n                    anyhow::ensure!(\n                        page_len > 0,\n                        \"AX fills returned an empty page with a next_cursor\"\n                    );\n                    anyhow::ensure!(\n                        seen_cursors.insert(next_cursor.clone()),\n                        \"AX fills pagination repeated cursor {next_cursor:?}\"\n                    );\n                    params.cursor = Some(next_cursor);\n                }\n                None => break,\n            }\n        }\n\n        if let Some(total_count) = expected_total {","sourceCodeStart":2258,"sourceCodeEnd":2294,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/architect_ax/src/http/client.rs#L2258-L2294","documentation":"If the server supplies a next_cursor, it must be a non-empty string — an empty cursor string cannot be sent back to request the next page and indicates a malformed paging response. The client rejects it so the caller doesn't loop or fail later with a bad request.","triggerScenarios":"A fills page response where next_cursor is Some(\"\") — server signaled 'more pages' but produced a blank cursor value.","commonSituations":"Server bug when the last page is exactly one row short; middleware trimming string fields; newer server serialization change the client wasn't built for.","solutions":["Capture the raw response JSON and confirm the empty next_cursor, then retry the pagination — often transient.","Treat the current page as final if the server keeps doing this: check whether the client and server versions agree on cursor semantics.","Report the empty-cursor response to the AX service team with the request parameters used.","If it coincides with an exact-multiple row count (page_len == limit), verify the server's end-of-data detection."],"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(\"empty next_cursor\") => {\n        warn!(\"AX blank cursor; treating current page as final if retry fails\");\n        client.paginate_fills(params).await.or_else(|_| fallback_partial_fetch(params))\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Retry once before giving up; blank cursors are often transient server bugs.","Record raw responses for bug reports to the AX team.","Verify client/server cursor-format compatibility after upgrades."],"tags":["rust","pagination","cursor","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-23T08:17:48.524Z"}