SonarSource/sonarqube · error · IllegalArgumentException
Maximum number of global webhooks reached
Error message
Maximum number of global webhooks reached
What it means
Thrown by CreateAction.checkNumberOfGlobalWebhooks when creating a global (project-less) webhook and the count of existing global webhooks already equals MAX_NUMBER_OF_WEBHOOKS. The api/webhooks/create endpoint returns a 400 IllegalArgumentException when the cap is hit.
Solutions
- List global webhooks with GET api/webhooks/list and delete stale ones via api/webhooks/delete.
- Update an existing global webhook (api/webhooks/update) rather than adding another.
- Move integration to project-level webhooks where per-project limits are separate.
Example fix
// before curl -u $ADMIN_TOKEN -X POST "$SONAR/api/webhooks/create?name=org-hook&url=$URL" // fails at cap // after COUNT=$(curl -su $ADMIN_TOKEN "$SONAR/api/webhooks/list" | jq '.webhooks | length') if [ "$COUNT" -lt 10 ]; then curl -u $ADMIN_TOKEN -X POST "$SONAR/api/webhooks/create?name=org-hook&url=$URL"; fi
Defensive patterns
Strategy: validation
Validate before calling
COUNT=$(curl -su "$ADMIN_TOKEN" "$SONAR/api/webhooks/list" | jq '.webhooks | length') [ "$COUNT" -lt 10 ] || echo "global webhook cap reached"
Try / catch
try {
createGlobalWebhook(...);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("Maximum number of global webhooks reached")) {
updateExistingGlobalWebhookInstead();
}
} Prevention
- Check-then-create (or update-in-place) in bootstrap scripts.
- Consolidate global webhooks into one relay endpoint rather than many.
- Audit global webhooks periodically with api/webhooks/list.
When it happens
Trigger: POST api/webhooks/create without a 'project' parameter while the instance already has the maximum number of global webhooks.
Common situations: Automated setup scripts that add a global webhook on every environment bootstrap; org-wide integrations accumulating after instance consolidation; repeated non-idempotent provisioning runs.
Related errors
- Maximum number of webhook reached for project
- %s
- Both 'severity' and 'impacts' parameters cannot be set at…
- Cannot change the assignee of this hotspot given its…
- Cannot parse
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/31d0d791aee5ae2d.
Report an issue: GitHub.
Appendix: source
Thrown at server/sonar-webserver-webapi/src/main/java/org/sonar/server/webhook/ws/CreateAction.java:180
.setUrl(dto.getUrl())
.setHasSecret(dto.getSecret() != null);
writeProtobuf(newBuilder().setWebhook(webhookBuilder).build(), request, response);
}
private static void checkNumberOfWebhook(int nbOfWebhooks, String projectKey) {
if (nbOfWebhooks >= MAX_NUMBER_OF_WEBHOOKS) {
throw new IllegalArgumentException(format("Maximum number of webhook reached for project '%s'", projectKey));
}
}
private int numberOfWebhookOf(DbSession dbSession, ProjectDto projectDto) {
return dbClient.webhookDao().selectByProject(dbSession, projectDto).size();
}
private void checkNumberOfGlobalWebhooks(DbSession dbSession) {
int globalWebhooksCount = dbClient.webhookDao().selectGlobalWebhooks(dbSession).size();
if (globalWebhooksCount >= MAX_NUMBER_OF_WEBHOOKS) {
throw new IllegalArgumentException("Maximum number of global webhooks reached");
}
}
}
View on GitHub (pinned to 184c821202)