SonarSource/sonarqube · warning · IllegalArgumentException
Message '%s' cannot be dismissed.
Error message
Message '%s' cannot be dismissed.
What it means
DismissAnalysisWarningAction.handle dismisses a CE task message for the current user and project. The message must exist and its type must be dismissible; attempting to dismiss a non-dismissible type throws IllegalArgumentException with MESSAGE_CANNOT_BE_DISMISSED. It protects system-level messages (e.g. errors) that users cannot opt out of.
Source
Thrown at server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/DismissAnalysisWarningAction.java:90
.setRequired(true)
.setExampleValue(Uuids.UUID_EXAMPLE_02);
}
@Override
public void handle(Request request, Response response) throws Exception {
userSession.checkLoggedIn();
String projectKey = request.mandatoryParam(PARAM_COMPONENT_KEY);
String messageKey = request.mandatoryParam(PARAM_MESSAGE_KEY);
try (DbSession dbSession = dbClient.openSession(false)) {
ProjectDto project = componentFinder.getProjectByKey(dbSession, projectKey);
userSession.checkEntityPermission(ProjectPermission.USER, project);
CeTaskMessageDto messageDto = dbClient.ceTaskMessageDao()
.selectByUuid(dbSession, messageKey)
.orElseThrow(() -> new NotFoundException(format(MESSAGE_NOT_FOUND, messageKey)));
if (!messageDto.getType().isDismissible()) {
throw new IllegalArgumentException(format(MESSAGE_CANNOT_BE_DISMISSED, messageKey));
}
Optional<UserDismissedMessageDto> result = dbClient.userDismissedMessagesDao().selectByUserAndProjectAndMessageType(dbSession,
userSession.getUuid(), project, messageDto.getType());
if (!result.isPresent()) {
dbClient.userDismissedMessagesDao().insert(dbSession, new UserDismissedMessageDto()
.setUuid(Uuids.create())
.setUserUuid(userSession.getUuid())
.setProjectUuid(project.getUuid())
.setMessageType(messageDto.getType()));
dbSession.commit();
}
response.noContent();
}
}
}View on GitHub (pinned to 184c821202)
Solutions
- Only dismiss messages of dismissible types (analysis warnings); fix the underlying issue for error-type messages instead
- Check the message type before calling the WS and skip non-dismissible ones
- Locate the root cause of the message (e.g. failed quality gate task) rather than dismissing
- Use a recent message uuid from the current task, not an archived one
Example fix
// before
dismiss(messageKey) // type = TASK_FAILED (not dismissible)
// after
if (messageType.isDismissible()) { dismiss(messageKey); } else { resolveUnderlyingIssue(); } Defensive patterns
Strategy: validation
Validate before calling
Ce.TaskMessage msg = getMessage(key); if (msg == null || !msg.getType().isDismissible()) return; // skip before calling dismiss WS
Type guard
function isDismissible(msg) { return msg && DISMISSIBLE_TYPES.includes(msg.type); } Try / catch
try { dismiss(key); } catch (BadRequest e) { log("message not dismissible; fix root cause"); } Prevention
- Check message type in the task detail before dismissing
- Only surface dismiss buttons for warning-type messages
- Resolve error-type messages at the source (fix the analysis/quality gate issue)
When it happens
Trigger: POST api/analysis_warnings/dismiss (or equivalent CE message dismiss WS) with a message uuid whose CeTaskMessageType.isDismissible() is false, e.g. task failure/error messages.
Common situations: UI or automation trying to silence analysis-error or other system messages instead of genuine warnings; stale message keys from older tasks being re-dismissed.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Unknown severity: %s
- ${e.getMessage()}
- Cannot parse '%s' : %s
- Languages should be set either by using 'languages = java' o
- Tags should be set either by using 'tags = java' or 'tags IN
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/5cb85cc6a61019c8.
Report an issue: GitHub.