Update: the best take away from your topic @merefield was
I guess I should be brave
![]()
Fiddling in a DB is always scary for me but in this case it worked.
For anyone with the same issue (duplicated tags / index_tags_on_name):
-
crack your fingers and start Inception Phase 1:
cd /var/discourse
sudo ./launcher enter appIf this fails because you get something like “no docker container running” or so type
sudo docker ps -a --no-trunc
This will list your available docker container and the ID. With that restart the container.
sudo docker restart <container ID>
Thensudo ./launcher enter appshould work. -
access your postgres DB and start Inception Phase 2:
su discourse
psql
The rebuild error log should have given you the culprit tag name. In my case it wasERROR: duplicate key value violates unique constraint "index_tags_on_name" 2023-01-27 07:46:45.663 UTC [584] discourse@discourse DETAIL: Key (name)=(hws-connect) already exists.So first search for your tag with
select * from tags where name='hws-connect';That gives you the table you can see above in my posts.
-
I just renamed the hws-connect tag to hws-connect1 with
UPDATE tags SET name = 'hws-connect1' WHERE name='hws-connect'; -
Leave the Inception with some kicks backwards:
\qto leave postgres
exitto leave the docker container -
Do the rebuild again with
sudo ./launcher rebuild app -
Be happy it works and verify in front end what you did:
Go to your tags page https://your-forum/tags
I have no clue how it happened and why this upgrade failed so badly - all previous ones worked, via web or terminal.
Will clean my tags up now.
Bonus:
- You click at the renamed tag.
- Remove it from all topics. 3 in my case.
- Go back to the tags page and use the top right feature:
All done. ![]()
Thanks for all your help guys.

