SonarSource/sonarqube · error · IllegalArgumentException

Param was not provided.

Error message

Param {paramKey} was not provided.

What it means

SonarLintPushAction.parseParam fetches a request parameter and throws IllegalArgumentException 'Param {paramKey} was not provided.' when the value is null. It backs the params validation of the SonarLint push endpoint (called via SonarLintPushActionParamsValidator).

Solutions

  1. Include the required projectKeys parameter in the request (comma-separated project keys).
  2. Update the SonarLint client to a version that sends the parameter.
  3. Check for proxy/gateway layers stripping query or body params.

Example fix

// before
GET /api/sonarlint/push_events?languages=java
// after
GET /api/sonarlint/push_events?projectKeys=my-project&languages=java
Defensive patterns

Strategy: validation

Validate before calling

if (projectKeys == null || projectKeys.isEmpty()) {
  throw new IllegalArgumentException("projectKeys is required");
}

Try / catch

try { pushAction.validateParams(); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("Param ") && e.getMessage().contains("was not provided")) { /* add missing param */ } }

Prevention

When it happens

Trigger: Calling the sonarlint push WS without the required 'projectKeys' (or other expected) parameter, so request.getParam(paramKey).getValue() returns null. Note getValue() returning empty string is NOT caught here — only null.

Common situations: API clients omitting projectKeys in the push-event request; query strings stripped by proxies; SDK versions of SonarLint that no longer send the param.

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


AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09). Data as JSON: /api/errors/d76c889af7951934. Report an issue: GitHub.

Appendix: source

Thrown at server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintPushAction.java:129

    private final Request request;
    private final Set<String> projectKeys;
    private final Set<String> languages;

    SonarLintPushActionParamsValidator(Request request) {
      this.request = request;
      this.projectKeys = parseParam(PROJECT_PARAM_KEY);
      this.languages = parseParam(LANGUAGE_PARAM_KEY);
    }

    Set<String> getLanguages() {
      return languages;
    }

    private Set<String> parseParam(String paramKey) {
      String paramProjectKeys = request.getParam(paramKey).getValue();
      if (paramProjectKeys == null) {
        throw new IllegalArgumentException("Param " + paramKey + " was not provided.");
      }
      return Set.of(paramProjectKeys.trim().split(","));
    }

    private void validateParams() {
      List<ProjectDto> projectDtos;
      try (DbSession dbSession = dbClient.openSession(false)) {
        projectDtos = dbClient.projectDao().selectProjectsByKeys(dbSession, projectKeys);
      }
      if (projectDtos.size() < projectKeys.size() || projectDtos.isEmpty()) {
        throw new IllegalArgumentException("Param " + PROJECT_PARAM_KEY + " is invalid.");
      }
    }

  }

}

View on GitHub (pinned to 184c821202)