# Tag gets broken if the first topic to use it is deleted

**URL:** <https://meta.discourse.org/t/tag-gets-broken-if-the-first-topic-to-use-it-is-deleted/51701>\
**Category:** Bug\
**Created:** [2016 年10 月 18 日 17:05 UTC](https://meta.discourse.org/t/tag-gets-broken-if-the-first-topic-to-use-it-is-deleted/51701 "2016-10-18T17:05:12Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

作者： ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)\
发布日期： [2016 年10 月 18 日 20:30 UTC](https://meta.discourse.org/t/tag-gets-broken-if-the-first-topic-to-use-it-is-deleted/51701/11 "2016-10-18T20:30:19Z")

</div>

On my localhost I started 4 new topics, the first two “ninja deleted”, using the post wrench on one and the topic wrench on the other.

I’m leaving the second two to try deleting after a hopefully sufficient delay to see if things are different after Jobs have a chance to run

Indeed, there is no record of the deletions in the Staff Logs.

Neither “newtaga” nor “newtagb” show in the /tags page.

And when another member tried to create another “newtaga” tag, it was “not found” and could not be created.

Running `SELECT * FROM tags` shows the tags still exist in the tags table.

```plaintext
id name topic_count created_at updated_at
3	project	2	2016-06-04 23:41:05.143569	2016-06-04 23:41:05.143569
4	shelved	3	2016-06-04 23:41:05.146382	2016-06-04 23:41:05.146382
1	data_explorer	2	2016-06-04 23:41:05.130565	2016-06-04 23:41:05.130565
2	core	9	2016-06-04 23:41:05.141164	2016-06-04 23:41:05.141164
5	newtaga	1	2016-10-18 19:19:09.921612	2016-10-18 19:19:09.921612
6	newtagb	1	2016-10-18 19:22:04.011328	2016-10-18 19:22:04.011328
7	newtagd	1	2016-10-18 19:25:45.883148	2016-10-18 19:25:45.883148
8	newtagc	1	2016-10-18 19:28:05.605267	2016-10-18 19:28:05.605267

```

I haven’t looked into what code is involved, and I haven’t tested my hunch yet. but I’m guessing that if the tag is title edited away before the topic is deleted it could be reused.

EDIT

Yes, editing the topic title to remove a tag before deleting the topic keeps the created (and unused) tag available for use

 ![](https://global.discourse-cdn.com/meta/original/3X/1/4/14f3a4c394f663e742af43907b27d38422109d88.png)

But it doesn’t show on the /tags page

---

_[View the full topic](https://meta.discourse.org/t/tag-gets-broken-if-the-first-topic-to-use-it-is-deleted/51701)._
