# Unable to create tag when name is in existing tag with underscore

**URL:** https://meta.discourse.org/t/unable-to-create-tag-when-name-is-in-existing-tag-with-underscore/52142
**Category:** Bug
**Created:** [28 oktober 2016 om 06:53 UTC](https://meta.discourse.org/t/unable-to-create-tag-when-name-is-in-existing-tag-with-underscore/52142 "2016-10-28T06:53:27Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [28 oktober 2016 om 06:53 UTC](https://meta.discourse.org/t/unable-to-create-tag-when-name-is-in-existing-tag-with-underscore/52142/1 "2016-10-28T06:53:27Z")

</div>

**Summary:** Over at Stonehearth we previously created tags like `crafting` and `crafting_suggestion`. Doing some cleanup, `crafting` was removed from all topics. Now we cannot recreate the tag.

**Steps to reproduce:**

1. Add a tag to a topic
2. Add a different tag to a topic that has two words separated by an underscore and one word being the above created tag.
3. Remove the tag from #1 from all topics “deleting” the tag.
4. Attempt to add the tag back to a topic.

**Expected Results:**

Tag is added to topic.

**Actual Results:**

Tag does not appear as an option

**Notes:**

This is likely an issue even if step 1 is skipped, but I haven’t tested it.

**Attachments:**

![](https://global.discourse-cdn.com/meta/optimized/3X/4/f/4fba9961187071bced355fe3c74d256199588c1f_2_690x88.png)

 ![](https://global.discourse-cdn.com/meta/original/3X/9/8/98a6e41273c44f6b5fbfbaea4c60746e1b43fdf9.png)

**Version Number:**

Discourse 1.7.0.beta5 ([discourse.stonehearth.net](http://discourse.stonehearth.net/))

**System Information:**

Windows 10 Education, Chrome Stable 54

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [28 oktober 2016 om 07:00 UTC](https://meta.discourse.org/t/unable-to-create-tag-when-name-is-in-existing-tag-with-underscore/52142/2 "2016-10-28T07:00:39Z")

</div>

Sure @neil can have a look.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [28 oktober 2016 om 16:06 UTC](https://meta.discourse.org/t/unable-to-create-tag-when-name-is-in-existing-tag-with-underscore/52142/3 "2016-10-28T16:06:47Z")

</div>

I can’t repro.

 ![](https://global.discourse-cdn.com/meta/original/3X/a/9/a954034817a6e2e3dae65407e2112e916afb5103.png)

Both tags appear, even though one has 0 topics.

![](https://global.discourse-cdn.com/meta/original/3X/f/c/fc7bb16c0d88aa3692106fd819023d90aad25e11.png)

---

<div class="post-metadata">

### Author: ![GSeven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gseven/32/61731_2.png) [@GSeven](https://meta.discourse.org/u/GSeven)
#### Post date: [28 oktober 2016 om 19:04 UTC](https://meta.discourse.org/t/unable-to-create-tag-when-name-is-in-existing-tag-with-underscore/52142/4 "2016-10-28T19:04:45Z")

</div>

I can reproduce it Neil.  
The key, which isn’t clear, is to press Rename Tag.

Remove the first tag from a topic. (crafting)  
Click the second tag, (crafting\_stuff) - and Rename Tag to ‘crafting’.(.com/tags/crafting\_stuff)  
Name has already been taken. Tag page shows no ‘crafting’ tag

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [28 oktober 2016 om 19:25 UTC](https://meta.discourse.org/t/unable-to-create-tag-when-name-is-in-existing-tag-with-underscore/52142/5 "2016-10-28T19:25:41Z")

</div>

I think the mistake is the assumption that removing “crafting” has deleted it. The error “name has already been taken” is telling the truth. There was a problem where unused tags were not being shown anywhere, which is probably why you thought they were deleted. I fixed that today. So you can find it on your `/tags` page or navigate to `/tags/crafting` and delete it.

We don’t automatically delete tags because we allow you to pre-define them. For example you can setup your tag groups like so:

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

---

<div class="post-metadata">

### Author: ![GSeven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gseven/32/61731_2.png) [@GSeven](https://meta.discourse.org/u/GSeven)
#### Post date: [28 oktober 2016 om 19:42 UTC](https://meta.discourse.org/t/unable-to-create-tag-when-name-is-in-existing-tag-with-underscore/52142/6 "2016-10-28T19:42:00Z")

</div>

gotcha, that makes sense, so even though on the tags page an unused but created tag doesn’t show, it’s still in the system and will show on the tags page once it is added to a post.

nice-one!

So i guess the OP should edit each post and add the ‘crafting’ tag, rather than renaming the exisiting ‘crafting\_suggestion’ tag.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [28 oktober 2016 om 19:43 UTC](https://meta.discourse.org/t/unable-to-create-tag-when-name-is-in-existing-tag-with-underscore/52142/7 "2016-10-28T19:43:09Z")

</div>

Or go to /tags/crafting, delete it, and then rename crafting\_suggestion to crafting.

---

<div class="post-metadata">

### Author: ![GSeven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gseven/32/61731_2.png) [@GSeven](https://meta.discourse.org/u/GSeven)
#### Post date: [28 oktober 2016 om 19:53 UTC](https://meta.discourse.org/t/unable-to-create-tag-when-name-is-in-existing-tag-with-underscore/52142/8 "2016-10-28T19:53:03Z")

</div>

> [@neil](#):
>
> Or go to /tags/crafting, delete it, and then rename crafting\_suggestion to crafting.

yep works like a charm.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [28 oktober 2016 om 20:27 UTC](https://meta.discourse.org/t/unable-to-create-tag-when-name-is-in-existing-tag-with-underscore/52142/9 "2016-10-28T20:27:34Z")

</div>



---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [29 oktober 2016 om 02:26 UTC](https://meta.discourse.org/t/unable-to-create-tag-when-name-is-in-existing-tag-with-underscore/52142/10 "2016-10-29T02:26:26Z")

</div>



---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [29 oktober 2016 om 02:36 UTC](https://meta.discourse.org/t/unable-to-create-tag-when-name-is-in-existing-tag-with-underscore/52142/11 "2016-10-29T02:36:09Z")

</div>

@neil, @GSeven thanks for the great discussion, however, I don’t think this actually addressed the issue I was seeing.

@neil, I think I understand the (now fixed) issue with tags not fully being removed. Assuming that was what was happening, then I shouldn’t have had an issue here. I resolved the issue with crafting by deleting the crafting tag from /tags/crafting and then was able to use it again. I was **not** trying to rename `crafting_suggestions` to `crafting`, I was trying to rename `craftin` (a temporary tag I created) to `crafting`.

The issue is still occurring at Stonehearth right now, try to create a topic with the `performance` tag. It is not being allowed:

 ![](https://global.discourse-cdn.com/meta/original/3X/6/7/672f5a3a95e59cc97e94aef0f60f83b741f90f93.png)

Once we get an update deployed I can go through /tags and delete all tags with no topics to solve this, but I don’t feel I should have to.
