{"record":{"id":"80b7399c31f6d34a","repo":"t8y2/dbx","slug":"process-candidate-name-paged-query-returned-row","errorCode":null,"errorMessage":"{process.candidate.name} paged query returned {rows} rows, expected {workload['max_rows']}","messagePattern":"(.+?) paged query returned (.+?) rows, expected (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"agents/drivers/argo-go/bench/agent_compare.py","lineNumber":527,"sourceCode":"                    \"sessionId\": session_id,\n                    \"pageSize\": workload[\"page_size\"],\n                    **({\"agentSessionId\": agent_session_id} if agent_session_id else {}),\n                },\n            )\n            rows += len(page.get(\"rows\", []))\n            session_id = page.get(\"session_id\")\n            has_more = page.get(\"has_more\", False)\n    finally:\n        if session_id:\n            process.call(\n                \"close_query_session\",\n                {\n                    \"sessionId\": session_id,\n                    **({\"agentSessionId\": agent_session_id} if agent_session_id else {}),\n                },\n            )\n    if rows != workload[\"max_rows\"]:\n        raise RuntimeError(\n            f\"{process.candidate.name} paged query returned {rows} rows, \"\n            f\"expected {workload['max_rows']}\"\n        )\n    return rows\n\n\ndef sample_result(count: int, elapsed: float, samples: list[float]) -> dict:\n    summary = summarize_latencies(samples)\n    summary.update(\n        {\n            \"count\": count,\n            \"elapsed_ms\": elapsed * 1000,\n            \"ops_per_sec\": count / elapsed,\n        }\n    )\n    return summary\n\n","sourceCodeStart":509,"sourceCodeEnd":545,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/argo-go/bench/agent_compare.py#L509-L545","documentation":"For \"paged\" workloads execute_workload counts the rows returned across all execute_query_page pages and asserts the total equals the workload's declared max_rows; a mismatch raises RuntimeError naming the candidate, actual and expected counts. This guards benchmark correctness — a candidate that silently truncates or duplicates rows would otherwise skew comparisons.","triggerScenarios":"Agent returns fewer or more rows than workload[\"max_rows\"] during paged execution: early end-of-stream, page aggregation bug, query returning a different row count than declared, or a mid-pagination error swallowed by the driver loop.","commonSituations":"Test table was modified (rows added/deleted) after max_rows was fixed in the workload config; agent's pager stops before exhausting the cursor; SQL with non-deterministic ORDER BY plus LIMIT yields different totals; concurrent benchmark runs mutating shared data.","solutions":["Update the workload's max_rows in the config to match the actual table row count (or regenerate the test table to the expected size)","Fix the agent's pagination loop so it fetches until the cursor is exhausted","Make the workload SQL deterministic (stable ORDER BY, fixed dataset) and re-run","Log each page's row count inside the pagination loop to locate which page short-changed the total"],"exampleFix":"// before\n{\"kind\": \"paged\", \"sql\": \"SELECT * FROM bench.events\", \"max_rows\": 100000}\n// after\n# re-sync test data, or:\n{\"kind\": \"paged\", \"sql\": \"SELECT * FROM bench.events\", \"max_rows\": 98250}  # actual count","handlingStrategy":"validation","validationCode":"actual = table_row_count(sql)\nif actual != workload[\"max_rows\"]:\n    raise ValueError(f\"workload max_rows={workload['max_rows']} but table has {actual} rows\")","typeGuard":null,"tryCatchPattern":"try:\n    rows = execute_workload(process, workload, agent_session_id)\nexcept RuntimeError as e:\n    if \"paged query returned\" in str(e):\n        print(f\"row-count mismatch: {e}; regenerate test data or update max_rows\")\n    else:\n        raise","preventionTips":["Regenerate the test table and max_rows together; never mutate shared bench data mid-run","Use deterministic queries (fixed WHERE, stable ORDER BY)","Log per-page row counts to find where pagination drifts","Re-verify counts after agent upgrades that change paging behavior"],"tags":["validation","pagination","data-integrity","benchmark"],"backgroundTag":"row-count-mismatch","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}