{"record":{"id":"d76c889af7951934","repo":"SonarSource/sonarqube","slug":"param-paramkey-was-not-provided","errorCode":null,"errorMessage":"Param {paramKey} was not provided.","messagePattern":"Param (.+?) was not provided\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintPushAction.java","lineNumber":129,"sourceCode":"\n    private final Request request;\n    private final Set<String> projectKeys;\n    private final Set<String> languages;\n\n    SonarLintPushActionParamsValidator(Request request) {\n      this.request = request;\n      this.projectKeys = parseParam(PROJECT_PARAM_KEY);\n      this.languages = parseParam(LANGUAGE_PARAM_KEY);\n    }\n\n    Set<String> getLanguages() {\n      return languages;\n    }\n\n    private Set<String> parseParam(String paramKey) {\n      String paramProjectKeys = request.getParam(paramKey).getValue();\n      if (paramProjectKeys == null) {\n        throw new IllegalArgumentException(\"Param \" + paramKey + \" was not provided.\");\n      }\n      return Set.of(paramProjectKeys.trim().split(\",\"));\n    }\n\n    private void validateParams() {\n      List<ProjectDto> projectDtos;\n      try (DbSession dbSession = dbClient.openSession(false)) {\n        projectDtos = dbClient.projectDao().selectProjectsByKeys(dbSession, projectKeys);\n      }\n      if (projectDtos.size() < projectKeys.size() || projectDtos.isEmpty()) {\n        throw new IllegalArgumentException(\"Param \" + PROJECT_PARAM_KEY + \" is invalid.\");\n      }\n    }\n\n  }\n\n}\n","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintPushAction.java#L111-L147","documentation":"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).","triggerScenarios":"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.","commonSituations":"API clients omitting projectKeys in the push-event request; query strings stripped by proxies; SDK versions of SonarLint that no longer send the param.","solutions":["Include the required projectKeys parameter in the request (comma-separated project keys).","Update the SonarLint client to a version that sends the parameter.","Check for proxy/gateway layers stripping query or body params."],"exampleFix":"// before\nGET /api/sonarlint/push_events?languages=java\n// after\nGET /api/sonarlint/push_events?projectKeys=my-project&languages=java","handlingStrategy":"validation","validationCode":"if (projectKeys == null || projectKeys.isEmpty()) {\n  throw new IllegalArgumentException(\"projectKeys is required\");\n}","typeGuard":null,"tryCatchPattern":"try { pushAction.validateParams(); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Param \") && e.getMessage().contains(\"was not provided\")) { /* add missing param */ } }","preventionTips":["Always send projectKeys on the SonarLint push endpoint","Build request URLs from a checked parameter map","Update SonarLint clients when the WS contract changes"],"tags":["push-api","sonarlint","missing-parameter","java"],"backgroundTag":"missing-required-argument","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}