Problem in upgrade: duplicate key value violates unique constraint

Hello,

I just used the upgrade tool to upgrade my discourse instance. Oddly, the forum is now down. When I tried to rebuild using the command line, I am getting this error:

duplicate key value violates unique constraint "index_tags_on_lower_name"

This error is repeated multiple times in the log so I recon its something about it.

Here is the full logs:
https://paste.apps.7ho.st/dezomakasu.sql (This is a portion of the logs, but here is the full log)

Could anyone help me out? I also restored a backup file from 7 hours ago way before this issue happened, But still same issue upon upgrade.

Thank you

You’ll need to rename some of those tags, I think. It’s not supposed to happen, but it did.

You’d start up the old container, and do something like:

./launcher start app
./launcher enter app
rails c
tags=Tag.where("name like '%ووکامرس%'")
tag1=tags[1]
tag1.name='bad1'
tag1.save

and so on for the others (maybe there are just 3?).

should I replace where the number is with the tag ID?

This is what I am getting up to tags=Tag.where("name like '%ووکامرس%'")

root@Seven-Forums-app:/var/www/discourse# rails c
[1] pry(main)> tags=Tag.where("name like '%ووکامرس%'")
=> [#<Tag:0x00007f0cef631638
  id: 26,
  name: "ووکامرس",
  created_at: Fri, 27 Jul 2018 07:05:01.048694000 UTC +00:00,
  updated_at: Fri, 27 Jul 2018 07:05:01.048694000 UTC +00:00,
  pm_topic_count: 0,
  target_tag_id: nil,
  description: nil>,
 #<Tag:0x00007f0cef61bfb8
  id: 108,
  name: "حمل-و-نقل-ووکامرس",
  created_at: Thu, 16 May 2019 10:12:19.073070000 UTC +00:00,
  updated_at: Thu, 16 May 2019 10:12:19.073070000 UTC +00:00,
  pm_topic_count: 0,
  target_tag_id: nil,
  description: nil>,
 #<Tag:0x00007f0cef61bef0
  id: 312,
  name: "ووکامرس",
  created_at: Sat, 23 Jan 2021 12:56:26.583839000 UTC +00:00,
  updated_at: Sat, 23 Jan 2021 12:56:26.583839000 UTC +00:00,
  pm_topic_count: 0,
  target_tag_id: nil,
  description: nil>,
 #<Tag:0x00007f0cef61bdd8
  id: 317,
  name: "مشکل-ووکامرس",
  created_at: Wed, 17 Feb 2021 20:32:41.416170000 UTC +00:00,
  updated_at: Wed, 17 Feb 2021 20:32:41.416170000 UTC +00:00,
  pm_topic_count: 0,
  target_tag_id: nil,
  description: nil>]