ERROR: duplicate key value violates unique constraint "pk_os_historystep"

HI, i'e getting this error:

Could not move to history step for #12605: root cause: while inserting: [GenericEntity:OSHistoryStep][owner,][caller,admin][dueDate,null][stepId,1][actionId,11][finishDate,2016-09-19 16:41:50.744][id,12712][startDate,2016-09-19 16:30:38.133][entryId,12605][status,null] (SQL Exception while executing the following:INSERT INTO public.OS_HISTORYSTEP (ID, ENTRY_ID, STEP_ID, ACTION_ID, OWNER, START_DATE, DUE_DATE, FINISH_DATE, STATUS, CALLER) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_os_historystep"))


Any clues?


1 answer

0 votes
Chris Fuller Atlassian Team Sep 19, 2016

This is a database corruption.

I'm not completely familiar with this part of the schema, but the fact that OSHistoryStep doesn't have its own entry in sequence_value_item leads me to believe that it is supposed to get its id from a moved OSCurrentStep rather than generating its own.  It would therefore be a problem if the same ID exists in both tables.  In other words, this query should return 0 rows:

SELECT id FROM os_historystep WHERE id IN (SELECT id FROM os_currentstep);


If it doesn't, then this would seem to be the problem.  But I'm not 100% certain how you got here or what the best way is to fix it.  If it were me, I'd probably take a backup of the database and then delete the offending rows from os_historystep.  That is, if you have your own JIRA Server or JIRA Data Center instance.

If you are in JIRA Cloud, there is a current incident related to problems in changes to the sequence value generation.  You should open a support request and include a reference to "HOT-47776" or this JRA:


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 09, 2018 in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

372 views 6 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you