Adding synonym to the same tag gets stuck

Hello all,

I accidently added tag A as synonym under tag A (accidently, on phone).

  • Delete synonym gives error 500
  • Unlink button gives error 422
  • Delete tag gives unknown error

Might be helpful

  • I can rename tag A to B and the synonym also gets edited.
  • Having 0 or 1 post with tag A makes no different for the errors above.

Can someone reproduce this?

2 Likes

That seems like something that should not be allowed to happen. I’m assuming that you ended up with something like this:

I’m testing this on my local development site. After creating the synonym, clicking the “Remove Synonym” button gives a 422 error. Clicking the trash icon for the synonym doesn’t give me a 500 error, instead it completely deletes the tag.

I think some protection should be added to prevent a tag from being set as its own synonym.

1 Like

Thanks for checking this issue.

Hmm ok that is different from my installation. I have no way to delete the tag or synonym at this point.

What version of DIscourse is your site on?

1 Like

I just upgraded to the newest build:

2.6.0.beta5 ( 811c610108 )

The behavior is the same as my OP.

1 Like

We should assign this next week @eviltrout, adding a tag as a synonym of itself is … not good.

2 Likes

Fixed via:

https://github.com/discourse/discourse/commit/473f7bfe7b1a2de6576e9c3366cce80329d8e401

Thanks for reporting this issue @MarcP. :+1:

4 Likes

Opening this topic per @MarcP’s request. He is not able to delete the tag even via console.

cd /var/discourse
./launcher enter app
rails c

tag = Tag.find_by_name("tag_name")
tag.destroy

The above is not working for Marc while it’s working for me. Can you expand your issue here Marc?

3 Likes

The command @techAPJ send me did not work for me, however I ran the (slightly different) commands found in: How can I delete a tag in development database (on local)?

I got the following results, trying to delete my tag “testing” which has a synonym tag: “testing”.

[1] pry(main)> t = Tag.find_by_name('testing')
=> #<Tag:0x000055a268f6f990
 id: 35,
 name: "testing",
 topic_count: 0,
 created_at: Wed, 11 Nov 2020 04:38:06 UTC +00:00,
 updated_at: Thu, 19 Nov 2020 03:44:35 UTC +00:00,
 pm_topic_count: 0,
 target_tag_id: 35>
[2] pry(main)> t.destroy!
SystemStackError: stack level too deep
from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.3/lib/active_record/reflection.rb:120:in `_reflect_on_association'
[3] pry(main)>

try:

DB.exec("delete from tags where name = 'testing'")
5 Likes

This worked! Thanks Sam :slight_smile: Have a nice week.

2 Likes