Duplicate workflow drafts results in 500 errors when editing an affected workflow
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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
Symptoms
When creating a draft workflow (invoking the Edit mode of a workflow which has a duplicated draft), a stack trace containing a message like this following is returned to the web browser:
1
java.lang.IllegalStateException: There are more than one draft workflows associated with the workflow named 'Workflow Name'
Cause
It's not certain how to reproduce this or what exactly causes the duplication of the drafts.
There's some hints on the cause being around concurrent uses of the workflows' editing feature. However, a test recently performed on our side returned no more than some {{404}} errors when two people were editing the same workflow.
The following bug was raised to our development and product management teams to study possible ways to resolve this. JRASERVER-40009 - Prevent JIRA from creating duplicate draft workflows.
Diagnosis
Run the below query to find out whether you have duplicated drafts or not and also what workflows are affected by this.
1
2
3
4
5
6
7
8
9
10
SELECT
COUNT(*) AS "# of Drafts",
parentname AS "Workflow",
MAX(id) AS "Duplicate"
FROM
jiradraftworkflows
GROUP BY
parentname
HAVING
count(*) > 1;
Workaround
Run the below query to delete the duplicated drafts.
Always back up your data before making any database modifications. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
1
2
DELETE FROM jiradraftworkflows WHERE id IN (
SELECT max(id) FROM jiradraftworkflows GROUP BY parentname HAVING count(*) > 1);
Was this helpful?