{"record":{"id":"de75f93efb09bb25","repo":"SonarSource/sonarqube","slug":"param-projectkeys-is-invalid","errorCode":null,"errorMessage":"Param projectKeys is invalid.","messagePattern":"Param projectKeys is invalid\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintPushAction.java","lineNumber":140,"sourceCode":"    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":122,"sourceCodeEnd":147,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintPushAction.java#L122-L147","documentation":"SonarLintPushAction.validateParams loads projects for the given projectKeys and throws IllegalArgumentException 'Param projectKeys is invalid.' when fewer projects are found than keys were provided, or none at all — meaning at least one provided key does not match an existing project.","triggerScenarios":"Passing projectKeys containing a nonexistent or deleted project key, or a branch/component key instead of a project key, so selectProjectsByKeys returns fewer rows than requested keys.","commonSituations":"Projects deleted or renamed in SonarQube while clients still reference old keys; typos in project keys; using module keys rather than project keys in the parameter.","solutions":["Validate each key via api/projects/search before calling and send only keys of existing projects.","Remove keys of deleted/renamed projects from the client configuration.","Ensure you use top-level project keys, not module or branch keys."],"exampleFix":"// before\nSet<String> keys = Set.of(\"old-project\", \"my-project\"); // old-project deleted\n// after\nSet<String> keys = Set.of(\"my-project\"); // only existing projects","handlingStrategy":"validation","validationCode":"Set<String> existing = dbClient.projectDao().selectProjectsByKeys(dbSession, projectKeys)\n  .stream().map(ProjectDto::getKey).collect(toSet());\nif (!existing.containsAll(projectKeys)) { /* drop or fix unknown keys before the call */ }","typeGuard":null,"tryCatchPattern":"try { pushAction.validateParams(); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"is invalid\")) { /* re-sync project keys */ } }","preventionTips":["Keep client-side project-key lists in sync with the server","Filter keys through api/projects/search before sending","Use project keys, not module or branch keys"],"tags":["push-api","sonarlint","validation","project-keys","java"],"backgroundTag":"invalid-argument-value","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"}