404 error when you revert a tag name after changing it without reloading the page

AI-generated summary

Canapin reported a minor but annoying bug where renaming a tag and then reverting it to a previous name (or the original name) without reloading the page results in a 404 error. The issue occurs because Discourse requests an incorrect /tag/<tag_name>/notifications route using an outdated or unused tag name.

The reproduction steps are:

  1. Open an existing tag page.
  2. Change the tag name and validate.
  3. Optionally change the name again.
  4. Revert the name to one previously used on the same screen.
  5. A 404 error appears.

martin acknowledged the detailed report and provided a fix via PR #31049, which was merged shortly after. The meta-bot confirmed the resolution, stating that renaming a tag back to its previous name no longer causes a 404 error in the updated version.

This is a very minor bug, sort of an edge case, but hitting a 404 is never pleasant as it triggers a “did I do something wrong?” when managing a website.

Changing a tag name and reverting it to a previous tag name choice on the same screen (meaning, without reloading the page) causes a 404 error.

tag 404)

tag 404

If you change a tag name at least once and end up choosing any tag name you previously validated on the same screen (or the original name), Discourses requests a wrong /tag/<tag_name>/notifications route using an unused tag_name, which results in a 404 error.

Reproduction steps:

  1. Open an existing tag page: https://your-discourse.com/tag/a

  2. Click the wrench, change the name and validate :white_check_mark:

  3. (optional) change the name again

  4. Revert the name to one of the previous ones (or the original tag name)

  5. :four: :zero: :four:

2 Likes

Thanks for the detailed report, I’ve got a fix for this now which should be merged soon:

https://github.com/discourse/discourse/pull/31049

3 Likes

Okay it’s merged now :rocket:

4 Likes

Fixed in #31049. Renaming a tag back to its previous name no longer causes a 404.