{"record":{"id":"d813b6d63b74e941","repo":"SonarSource/sonarqube","slug":"user-does-not-exist","errorCode":null,"errorMessage":"User does not exist","messagePattern":"User does not exist","errorType":"http","errorClass":"ForbiddenException","httpStatus":403,"severity":"error","filePath":"server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintClientPermissionsValidator.java","lineNumber":60,"sourceCode":"    this.userSessionFactory = userSessionFactory;\n  }\n\n  public List<ProjectDto> validateUserCanReceivePushEventForProjects(UserSession userSession, Set<String> projectKeys) {\n    List<ProjectDto> projectDtos;\n    try (DbSession dbSession = dbClient.openSession(false)) {\n      projectDtos = dbClient.projectDao().selectProjectsByKeys(dbSession, projectKeys);\n    }\n    validateProjectPermissions(userSession, projectDtos);\n    return projectDtos;\n  }\n\n  public void validateUserCanReceivePushEventForProjectUuids(String userUuid, Set<String> projectUuids) {\n    UserDto userDto;\n    try (DbSession dbSession = dbClient.openSession(false)) {\n      userDto = dbClient.userDao().selectByUuid(dbSession, userUuid);\n    }\n    if (userDto == null) {\n      throw new ForbiddenException(\"User does not exist\");\n    }\n    UserSession userSession = userSessionFactory.create(userDto, false);\n    List<ProjectDto> projectDtos;\n    try (DbSession dbSession = dbClient.openSession(false)) {\n      projectDtos = dbClient.projectDao().selectByUuids(dbSession, projectUuids);\n    }\n    validateProjectPermissions(userSession, projectDtos);\n  }\n\n  private static void validateProjectPermissions(UserSession userSession, List<ProjectDto> projectDtos) {\n    validateUsersDeactivationStatus(userSession);\n    for (ProjectDto projectDto : projectDtos) {\n      userSession.checkEntityPermission(ProjectPermission.USER, projectDto);\n    }\n  }\n\n  private static void validateUsersDeactivationStatus(UserSession userSession) {\n    if (!userSession.isActive()) {","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintClientPermissionsValidator.java#L42-L78","documentation":"SonarLintClientPermissionsValidator.validateUserCanReceivePushEventForProjectUuids loads the user by UUID and throws ForbiddenException 'User does not exist' when userDao.selectByUuid returns null. It protects the push-event API so events are only prepared for real, existing users.","triggerScenarios":"Requesting push events for a userUuid that is not in the users table (deleted user, wrong UUID, stale cached UUID from a deactivated-then-purged account).","commonSituations":"SonarLint IDE clients holding an old user UUID after the account was deleted and recreated; environment sync where a user exists in a shadow store but not in the SonarQube DB; UUID/SCRN login confusion.","solutions":["Verify the userUuid against GET api/users/current and use the returned UUID.","Re-create or restore the user account if it was deleted.","Clear the client's cached identity/credentials and reconnect so a fresh UUID is obtained."],"exampleFix":"// before\nvalidator.validateUserCanReceivePushEventForProjectUuids(staleUuid, projectUuids);\n// after\nUserDto user = dbClient.userDao().selectByUuid(dbSession, staleUuid);\nif (user != null) {\n  validator.validateUserCanReceivePushEventForProjectUuids(staleUuid, projectUuids);\n}","handlingStrategy":"try-catch","validationCode":"boolean exists = dbClient.userDao().selectByUuid(dbSession, userUuid) != null; // or GET api/users/current first","typeGuard":null,"tryCatchPattern":"try { validator.validateUserCanReceivePushEventForProjectUuids(uuid, uuids); } catch (ForbiddenException e) { if (\"User does not exist\".equals(e.getMessage())) { reconnectWithFreshIdentity(); } }","preventionTips":["Resolve the UUID via api/users/current before push-event calls","Refresh cached user identity after account deletion/recreation","Handle 403 from push endpoints as 're-authenticate'"],"tags":["push-api","sonarlint","forbidden","user-lookup","java"],"backgroundTag":"user-not-found","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"}