SonarCloud Issue Search Sorts Are Not a Total Order Across Pages

ALM used: Not applicable. This is the Web API, reproducible with plain unauthenticated GET requests.

CI system used: Not applicable.

Scanner command used: Not applicable. No scanner is involved.

Languages of the repository: Java, JavaScript, web (HTML), CSS and PL/SQL (from the languages facet of the issues search on this project).

Public project: bdoyal_bdoyal-getpixee-webgoat

Error observed

Paging api/issues/search with s=CREATION_DATE, UPDATE_DATE or SEVERITY returns some issues on more than one page, and so never returns others. paging.total stays correct (2,069), so a client can’t tell. The same query with s=FILE_LINE, or with no s, returns every issue exactly once.

The open-source SonarQube Server code appends the issue key as the last sort field for every named sort (IssueIndex, L261-L291), which should make each order total. SonarQube Cloud doesn’t behave that way for these three sorts.

Counts for the project above (ps=250, 9 pages, 3 runs per sort, 2026-10-07, no token):

s Duplicates per run Unique issues returned
CREATION_DATE 224 / 500 / 646 1,845 / 1,569 / 1,423 of 2,069
UPDATE_DATE 673 / 646 / 396 1,396 / 1,423 / 1,673
SEVERITY 216 / 555 / 186 1,853 / 1,514 / 1,883
FILE_LINE 0 / 0 / 0 2,069
none 0 / 0 / 0 2,069

Here 499 of the first 500 issues share creationDate=2024-09-17T01:26:59+0000. Projects whose issues have distinct creation dates did not show the problem (four other projects tried, up to 10,000 issues). A similar report exists for SonarQube 9.9: Inconsistent pagination in SonarQube 9.9 Issues Search API when issues have the same creationDate

Steps to reproduce

for p in 1 2 3 4 5 6 7 8 9; do
  curl -s "https://sonarcloud.io/api/issues/search?componentKeys=bdoyal_bdoyal-getpixee-webgoat&resolved=false&ps=250&p=$p&s=CREATION_DATE"
done

Collect the key of every issue across the 9 pages and count the distinct values. Repeat with s=FILE_LINE and compare. (One run of the loop above returned 2,069 issues, 1,491 of them distinct.)

Potential workaround

s=FILE_LINE returned all 2,069 unique issues in 3 of 3 runs, and 327 of the first 2,000 issues share a (file, line, severity) group, so ties do occur there. We can’t tell whether it is guaranteed.

Questions

  1. Is the key tiebreaker intentionally absent for these sorts on SonarQube Cloud?
  2. Is FILE_LINE guaranteed to be a total order?
  3. Is there a supported way to page a full result set reliably? api/projects/export_findings returns 404 on SonarQube Cloud.

Hi @gilday,

Thank you for the detailed report and root cause investigation, it made it really easy to nail down.

We’ve confirmed the issue on our side and the fix will ship soon.

Thanks