Transitioning an Issue Results in a Workflow Error
Platform Notice: Data Center Only - This article only applies to Atlassian apps 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
You attempt to transition an issue to a new status and then...
The following appears:
Could not move to history step for #175444: root cause: while inserting: [GenericEntity:OSHistoryStepPrev][id,373216][previousId,373215] (SQL Exception while executing the following:INSERT INTO public.OS_HISTORYSTEP_PREV (ID, PREVIOUS_ID) VALUES (?, ?) (ERROR: duplicate key value violates unique constraint "pk_os_historystep_prev")) Possible Causes
There is a value in both the os_historystep and os_historystep_prev tables which are the same.
Possible Resolutions
Warning: Backup your database before proceeding.
Before running any SQL in this article, create a full backup of your Jira database. This is a database-level operation with no undo other than restoring from backup. Only proceed if you're comfortable running SQL directly against the Jira database, and test on a staging or cloned environment first, wherever possible.
In your os_historystep_prev table, delete the entire row with the max(id), restart JIRA, and attempt the transition again.
If you have scripts running in any conditions, validators or post functions, make sure they haven't any errors. Delete them to see if this fixes the issue.
If your case is #1, use this command to delete the row
delete from os_historystep_prev where id = <id pertaining to the error>;ℹ️Please remember torestart JIRA if making changes to the database.
Was this helpful?