# Duplicate key value violates unique constraint

**URL:** <https://community.n8n.io/t/duplicate-key-value-violates-unique-constraint/4063>\
**Category:** Questions\
**Created:** [January 28, 2021, 11:23pm UTC](https://community.n8n.io/t/duplicate-key-value-violates-unique-constraint/4063 "2021-01-28T23:23:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Msaustral](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@Msaustral](https://community.n8n.io/u/Msaustral)\
**Post date:** [January 28, 2021, 11:23pm UTC](https://community.n8n.io/t/duplicate-key-value-violates-unique-constraint/4063/1 "2021-01-28T23:23:16Z")

</div>

Hi everyone, some times we are getting this error when we try to save

There was a problem saving the workflow: "duplicate key value violates unique constraint “pk\_eded7d72664448da7745d551207"”

the workaround, copy on notepac the unsafe change, reload the page, paste the code and save.

---

<div class="post-metadata">

**Author:** ![achamm](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/achamm/32/143734_2.png) [@achamm](https://community.n8n.io/u/achamm)\
**Post date:** [January 31, 2026, 7:50am UTC](https://community.n8n.io/t/duplicate-key-value-violates-unique-constraint/4063/2 "2026-01-31T07:50:26Z")

</div>

that’s a postgres constraint error - usually means n8n is trying to insert a workflow version with an id that already exists in the database.

couple things to try:

1. check if you have multiple n8n instances running that might be writing to the same db

2. restart your n8n instance and postgres - sometimes the sequence gets out of sync

3. if youre on self-hosted, check your postgres logs around the time it happens to see the exact constraint

does this happen with a specific workflow or random ones? and are you running latest n8n version?
