Duplicate key value violates unique constraint "links_uniq_total"

  • Used Zammad version: This is Zammad version 6.3.1-1725647124.f95b780e.focal
  • Used Zammad installation type: package
  • Operating system: Ubuntu Server 22
  • Browser + version: Multiple browsers and versions used

Expected behavior:

  • Tickets merge successfully as I have hundreds of times, including minutes earlier before the error appeared

Actual behavior:

  • Error pops up:
  • PG::InFailedSqlTransaction: ERROR: current transaction is aborted, commands ignored until end of transaction block

Steps to reproduce the behavior:

  • Click on Ticket > Merge > select second ticket to merge into > Submit

tail -f postgresql-12-main.log shows:

2024-09-08 23:36:02.317 UTC [10646] zammad@zammad ERROR: duplicate key value violates unique constraint “links_uniq_total”
2024-09-08 23:36:02.317 UTC [10646] zammad@zammad DETAIL: Key (link_object_source_id, link_object_source_value, link_object_target_id, link_object_target_value, link_type_id)=(1, 9783, 1, 9783, 1) already exists.
2024-09-08 23:36:02.317 UTC [10646] zammad@zammad STATEMENT: UPDATE “links” SET “link_object_target_value” = $1 WHERE “links”.“link_object_target_id” = $2 AND “links”.“link_object_target_value” = $3
2024-09-08 23:36:02.416 UTC [10646] zammad@zammad ERROR: current transaction is aborted, commands ignored until end of transaction block
2024-09-08 23:36:02.416 UTC [10646] zammad@zammad STATEMENT: SELECT “settings”.* FROM “settings” WHERE “settings”.“area” = $1 ORDER BY “settings”.“name” ASC

Well, something I noticed yesterday, is that the tickets this error appears on, does add a link to the other ticket I am attempting to merge on the right hand side of the ticket window.

Here’s an example:


So it merges, yet doesn’t close the previous ticket. Then I am guessing I try to merge it a second time, then the error appears? And a second link also is added, as if it did do it a second time anyways.

Not sure about this as I am waiting for another opportunity to test this (tickets to be merged).

Ensure that all your migrations are up to date and executed. Easiest approach to re-run everything that happens during a Zammad-Update is to run /opt/zammad/contrib/packager.io/postinstall.sh.

There may only be one ticket link per ticket. The same ticket cannot appear several times. Most likely you skipped steps during the upgrade which causes a faulty database state.

Thank you for that. I let this go for a bit to see if it came up again, to recreate the issue. So far so good.

I saved that step you provided and will apply this to every update moving forward. I appreciate it.