SonarSource/sonarqube · error · IllegalArgumentException
uuids can not be empty
Error message
uuids can not be empty
What it means
wildCardStringFor builds a SQL IN placeholder list for a batch of file uuids; an empty list cannot produce a valid IN clause, so it throws IllegalArgumentException. This is an internal pre-condition: the caller should never invoke it with zero uuids.
Solutions
- Guard the caller: skip the query when the uuid batch list is empty.
- If you modified the batching code, restore the non-empty-batch invariant before calling the helper.
- If seen in stock SonarQube, report it with the CE task logs as a bug.
Example fix
// before
String placeholders = wildCardStringFor(uuidBatch);
// after
if (!uuidBatch.isEmpty()) {
String placeholders = wildCardStringFor(uuidBatch);
...
} Defensive patterns
Strategy: validation
Validate before calling
if (uuids == null || uuids.isEmpty()) {
return; // skip query entirely, no IN clause possible
} Type guard
boolean isNonEmptyBatch(List<String> uuids) {
return uuids != null && !uuids.isEmpty();
} Try / catch
try {
placeholders = wildCardStringFor(uuids);
} catch (IllegalArgumentException e) {
logger.warn("Empty uuid batch, skipping query");
} Prevention
- Always skip SQL IN queries when the id batch is empty
- Chunk id lists before building placeholders
- Cover the batching loop with a unit test for the empty-input edge case
When it happens
Trigger: Internally: calling wildCardStringFor(List.of()) — in practice only from a bug in ExportLineHashesStep's batching loop iterating an empty uuid batch, or when overridden/test code passes an empty list.
Common situations: Rarely seen in production; mostly surfaces from code modifications or custom forks that change the batching logic, or unit tests exercising the helper with empty input.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Analysis Export failed after processing
- Branch export failed after processing
- Component Export failed after processing
- Error during processing of row
- Failed to insert row with value
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/1a1796560c6f2eb0.
Report an issue: GitHub.
Appendix: source
Thrown at server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/file/ExportLineHashesStep.java:117
" order by created_at, uuid";
PreparedStatement stmt = dbClient.getMyBatis().newScrollingSelectStatement(dbSession, format(sql, wildCardStringFor(uuids)));
try {
int i = 1;
for (String uuid : uuids) {
stmt.setString(i, uuid);
i++;
}
return stmt;
} catch (Exception e) {
DatabaseUtils.closeQuietly(stmt);
throw e;
}
}
private static String wildCardStringFor(List<String> uuids) {
switch (uuids.size()) {
case 0:
throw new IllegalArgumentException("uuids can not be empty");
case 1:
return "?";
default:
return createWildCardStringFor(uuids);
}
}
private static String createWildCardStringFor(List<String> uuids) {
int size = (uuids.size() * 2) - 1;
char[] res = new char[size];
for (int j = 0; j < size; j++) {
if (j % 2 == 0) {
res[j] = '?';
} else {
res[j] = ',';
}
}
return new String(res);View on GitHub (pinned to 184c821202)