Unable to add a new group due to error A group or user with this name already exists
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
When attempting to add a new group to Jira, the administrator is presented with the error, "A group or user with this name already exists."
However, when attempting to filter for existing groups with the same name, no such group with that name is displayed.
The following image demonstrates how this would appear to the administrator.
Diagnosis
Diagnostic Steps
You are affected if the following conditions are met:
Attempting to filter by the specific group does not display any matches in the list of groups.
Querying for the specific group against the database does not return any matches.
select * from cwd_group where lower_group_name like '%examplegroup%';
Cause
This issue occurs when there is an integrity issue between Jira's caches and the database. Adding a group first checks Jira's caches in order to validate whether the group already exists in them, whereas the list of groups displayed are pulled from the database directly. If the caches contain the group, but the database does not, this leads to this inconsistency.
This issue can be triggered when a group is removed from the database but not from the caches- it is possible that automation, customizations, and/or 3rd party functionalities may cause this due to bugs in their implementation.
Workaround
No known workaround at this time.
Resolution
Resolving this requires these caches to be rebuilt. Jira will need to be restarted, which will drop these caches and recreate them from the database upon the next startup. If this is a data center instance then a rolling restart may not be sufficient and a hard stop and start of JIRA on all nodes will be necessary.