"Group name already in use. Please choose another to continue" error when migrating service projects
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
Summary
Check what to do when your service project migration fails with "Group name already in use. Please choose another to continue".
Overview
When using the Jira Cloud Migration Assistant (JCMA), the error message below will surface when there is a duplicate Request Type Group under the JSM Project Request Type.
One situation where this problem can surface is if you have a group that was deleted and then a new group was created with the same name.
The group is flagged as deleted on the database but still present on the database table with a deletion flag.
This means a new database entry would be created for that group. So when JCMA imports the entries, it'll flag them as duplicated.
ERROR <pkey> project-import We couldn't import Request Type Group <group id>.
Reason: 400 Bad Request: "{"errors":[{"errorMessage":"Group name already in use. Please choose another to continue"}],
"reasonKey":"sd.admin.request.groups.add.name.duplicate.error","reasonCode":"400"}".
Solution
Identify the groups
We must first identify which invalid or duplicated group is referenced in the error message.
The below SQL query will bring all Request Types Groups and their count per Project.
There can be only 1 Group name per JSM Project.
SELECT "GROUP_NAME"
, "VIEWPORT_ID"
, COUNT(*) AS count
FROM "AO_54307E_GROUP"
GROUP BY "GROUP_NAME", "VIEWPORT_ID"
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC;
SELECT GROUP_NAME
, VIEWPORT_ID
, COUNT(*) AS count
FROM AO_54307E_GROUP
GROUP BY GROUP_NAME, VIEWPORT_ID
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC;
You'll be looking for the names of the groups in the query results. The query will only list duplicate groups, giving you their names.
Get the group's ID
If you have duplicated groups and none are deleted, you'll want to choose one of them to fix.
Suggestion: Choose the one with the higher ID.
Run this query to identify the IDs of the groups to be fixed.
WITH dup_groups AS (
SELECT "GROUP_NAME"
, "VIEWPORT_ID"
, COUNT(*) AS count
FROM "AO_54307E_GROUP"
GROUP BY "GROUP_NAME", "VIEWPORT_ID"
HAVING COUNT(*) > 1
)
SELECT g."ID"
, g."GROUP_NAME"
, g."VIEWPORT_ID"
, g."DELETED_TIME"
FROM "AO_54307E_GROUP" g
INNER JOIN dup_groups d ON (d."GROUP_NAME" = g."GROUP_NAME" AND d."VIEWPORT_ID" = g."VIEWPORT_ID")
ORDER BY g."ID";
WITH dup_groups AS (
SELECT GROUP_NAME
, VIEWPORT_ID
, COUNT(*) AS count
FROM AO_54307E_GROUP
GROUP BY GROUP_NAME, VIEWPORT_ID
HAVING COUNT(*) > 1
)
SELECT g.ID
, g.GROUP_NAME
, g.VIEWPORT_ID
, g.DELETED_TIME
FROM AO_54307E_GROUP g
INNER JOIN dup_groups d ON (d.GROUP_NAME = g.GROUP_NAME AND d.VIEWPORT_ID = g.VIEWPORT_ID)
ORDER BY g.ID;
SELECT g.ID
, g.GROUP_NAME
, g.VIEWPORT_ID
, g.DELETED_TIME
FROM AO_54307E_GROUP g
INNER JOIN ( SELECT GROUP_NAME
, VIEWPORT_ID
, COUNT(*) AS count
FROM AO_54307E_GROUP
GROUP BY GROUP_NAME, VIEWPORT_ID
HAVING COUNT(*) > 1 ) d ON (d.GROUP_NAME = g.GROUP_NAME AND d.VIEWPORT_ID = g.VIEWPORT_ID)
ORDER BY g.ID;
Fix the groups
The fix is to rename the duplicate group (the deleted one). If the duplicate group is not deleted, go with the higher ID one.
A simple update to rename the group will prevent the error from surfacing again in JCMA:
In the query below:
- <new Group name>: placeholder for the new name of the duplicated Group you're renaming
- <ID of the dup Group>: placeholder for the ID of the Group you'll be fixing - the ID of the deleted Group, if applicable, or the higher ID if the Group is not deleted
UPDATE "AO_54307E_GROUP" SET "GROUP_NAME" = '<new Group name>' WHERE "ID" = <ID of the dup Group>;
UPDATE AO_54307E_GROUP SET GROUP_NAME = '<new Group name>' WHERE ID = <ID of the dup Group>;