SonarSource/sonarqube · error · IllegalArgumentException
"Parameter '" + key + "' not found for action '" +…
Error message
"Parameter '" + key + "' not found for action '" + action.key() + "'"
What it means
ValidatingRequest.multiParam(key) is a typed accessor for multi-valued web service parameters. It first looks up the parameter in the WebService action's definition; if the action does not declare a parameter with that key, it throws IllegalArgumentException. The library throws this to force plugins to declare their parameters so documentation and validation stay consistent.
Solutions
- Declare the parameter in the action's define() via createParam(key).... before reading it with multiParam(key).
- Fix the key typo so it matches the declared param name.
- If reading arbitrary keys is intentional, switch to an untyped read (e.g. request.getMultiParam or the raw request) instead of multiParam.
Example fix
// before
List<String> values = request.multiParam("repositories");
// after (in the action's define())
public void define(WebService.NewAction action) {
action.createParam("repositories").setMultiple(true);
}
// then in the handler
List<String> values = request.multiParam("repositories"); Defensive patterns
Strategy: validation
Validate before calling
// Java
if (action.param(key) == null) {
throw new IllegalStateException("Parameter not declared for action: " + key);
}
List<String> values = request.multiParam(key); Prevention
- Declare every parameter you read in the action's define() method as a first step.
- Keep parameter keys in constants shared between define() and the handler.
- Review new request.read* calls in code review against the define() parameter list.
When it happens
Trigger: Calling request.multiParam("some_key") inside a WebService.SearchRequest implementation where the action never called createParam(...).param("some_key") in define().
Common situations: Plugin code reads a parameter that was added on the client/request side but forgotten in the action's define() method; a typo in the key; a parameter declared under a deprecated key that no longer matches.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- format("' ' value ' ' cannot be parsed as an integer", key…
- Request parameters are not allowed to contain NUL character
- format(CAN_NOT_LOAD_FROM_CLASSPATH, EDITION_FILE_PATH)
- format(CAN_NOT_LOAD_FROM_CLASSPATH, filePath)
- format("Invalid edition found in ' ': ' '"…
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/8022c7db2e942f5c.
Report an issue: GitHub.
Appendix: source
Thrown at sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/ws/ValidatingRequest.java:88
String rawValue = readParam(key, definition);
String rawValueOrDefault = Objects.toString(rawValue, definition.defaultValue());
String value = rawValueOrDefault == null ? null : trim(rawValueOrDefault);
validateRequiredValue(key, definition, rawValue);
if (value == null) {
return null;
}
validatePossibleValues(key, value, definition);
validateMaximumLength(key, definition, rawValueOrDefault);
validateMinimumLength(key, definition, rawValueOrDefault);
validateMaximumValue(key, definition, value);
return value;
}
@Override
public List<String> multiParam(String key) {
WebService.Param definition = action.param(key);
if (definition == null) {
throw new IllegalArgumentException("Parameter '" + key + "' not found for action '" + action.key() + "'");
}
List<String> values = readMultiParamOrDefaultValue(key, definition);
return validateValues(values, definition);
}
private static String trim(String s) {
int begin;
for (begin = 0; begin < s.length(); begin++) {
if (!Character.isWhitespace(s.charAt(begin))) {
break;
}
}
int end;
for (end = s.length(); end > begin; end--) {
if (!Character.isWhitespace(s.charAt(end - 1))) {
break;
}View on GitHub (pinned to 184c821202)