SonarSource/sonarqube · error · IllegalArgumentException
Invalid qualifier, available are:
Error message
Invalid qualifier, available are:
What it means
The api/projects/search WS validates requested qualifiers against the set available for the current edition (via getQualifiersFromEdition). If none of the requested qualifiers resolve to an available one, getQualifiersBasedOnEdition throws this IllegalArgumentException listing the valid qualifiers.
Solutions
- Use qualifiers from the list appended to the error message (e.g. TRK, APP for the edition in use).
- Check the SonarQube edition actually installed and align qualifiers with it.
- Fix typos/case in qualifier codes (they are uppercase, e.g. TRK).
- Omit the qualifiers parameter to use the endpoint default instead of passing unknown values.
Example fix
// before GET /api/projects/search?qualifiers=TRK,VW // VW not available in this edition // after GET /api/projects/search?qualifiers=TRK
Defensive patterns
Strategy: validation
Validate before calling
Set<String> available = editionSupportsApplications() ? Set.of("TRK", "APP") : Set.of("TRK");
if (!requestedQualifiers.stream().allMatch(available::contains)) {
throw new IllegalArgumentException("Unknown qualifiers; use one of " + available);
} Try / catch
try {
response = ws.searchProjects("qualifiers=" + qualifiers);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Invalid qualifier")) {
response = ws.searchProjects(""); // drop qualifiers, use endpoint default
} else throw e;
} Prevention
- Fetch valid qualifiers from the error message or edition documentation before querying.
- Avoid hardcoding qualifiers in CI scripts; detect the edition at runtime.
- Keep qualifier codes uppercase and copy them exactly (e.g. TRK, APP).
When it happens
Trigger: Calling api/projects/search with a 'qualifiers' parameter whose values do not intersect the edition's available qualifiers (e.g. requesting TRK only when the edition exposes different qualifiers, or misspelling a qualifier like 'TRUNK').
Common situations: Community vs commercial edition differences changing the qualifier set; hardcoded qualifiers in scripts/CI jobs written against a different edition; typos in qualifier codes.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Cannot change the assignee of this hotspot given its…
- Cannot parse
- ${e.getMessage()}
- Invalid message type:
- Languages should be set either by using 'languages = java'…
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/45173a43daefccf5.
Report an issue: GitHub.
Appendix: source
Thrown at server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SearchProjectsAction.java:301
.favoriteProjectUuids(favoriteProjectUuids)
.searchResults(esResults)
.analysisByProjectUuid(analysisByProjectUuid)
.applicationsLeakPeriods(applicationsLeakPeriod)
.query(query)
.build();
}
private Set<String> getQualifiersBasedOnEdition(ProjectMeasuresQuery query) {
Set<String> availableQualifiers = getQualifiersFromEdition();
Set<String> requestQualifiers = query.getQualifiers().orElse(availableQualifiers);
Set<String> resolvedQualifiers = requestQualifiers.stream()
.filter(availableQualifiers::contains)
.collect(Collectors.toSet());
if (!resolvedQualifiers.isEmpty()) {
return resolvedQualifiers;
} else {
throw new IllegalArgumentException("Invalid qualifier, available are: " + String.join(",", availableQualifiers));
}
}
private Set<String> getQualifiersFromEdition() {
Optional<Edition> edition = editionProvider.get();
if (edition.isEmpty()) {
return Sets.newHashSet(ComponentQualifiers.PROJECT);
}
return switch (edition.get()) {
case ENTERPRISE, DATACENTER, DEVELOPER -> Sets.newHashSet(ComponentQualifiers.PROJECT, ComponentQualifiers.APP);
default -> Sets.newHashSet(ComponentQualifiers.PROJECT);
};
}
private static boolean hasFavoriteFilter(List<Criterion> criteria) {
return criteria.stream()View on GitHub (pinned to 184c821202)