# Add Tags 500 Error

**URL:** https://meta.discourse.org/t/add-tags-500-error/129085
**Category:** Self-hosting
**Created:** [September 20, 2019, 8:33am UTC](https://meta.discourse.org/t/add-tags-500-error/129085 "2019-09-20T08:33:38Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![appcomqa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/appcomqa/32/133414_2.png) [@appcomqa](https://meta.discourse.org/u/appcomqa)
#### Post date: [September 20, 2019, 8:33am UTC](https://meta.discourse.org/t/add-tags-500-error/129085/1 "2019-09-20T08:33:38Z")

</div>

Hi,

I just add Tags, 500 Error.

logs:

```plaintext
ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_tags_on_name" DETAIL: Key (name)=(TAGTEST) already exists. ) /var/www/discourse/vendor/bu

Failed to handle exception in exception app middleware : PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_tags_on_name" DETAIL: Key (name)=(TAGTEST) already exists.

```

Discourse 2.4.0.beta4

---

<div class="post-metadata">

### Author: ![appcomqa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/appcomqa/32/133414_2.png) [@appcomqa](https://meta.discourse.org/u/appcomqa)
#### Post date: [September 20, 2019, 8:37am UTC](https://meta.discourse.org/t/add-tags-500-error/129085/2 "2019-09-20T08:37:45Z")

</div>

and old tags 404 Error.

---

<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: [September 20, 2019, 9:02am UTC](https://meta.discourse.org/t/add-tags-500-error/129085/3 "2019-09-20T09:02:02Z")

</div>

Per the error it is a duplicate tag of some kind?

---

<div class="post-metadata">

### Author: ![appcomqa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/appcomqa/32/133414_2.png) [@appcomqa](https://meta.discourse.org/u/appcomqa)
#### Post date: [September 20, 2019, 9:06am UTC](https://meta.discourse.org/t/add-tags-500-error/129085/4 "2019-09-20T09:06:31Z")

</div>

TAGTESTx4

Some existing tags can’t be added.

---

<div class="post-metadata">

### Author: ![appcomqa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/appcomqa/32/133414_2.png) [@appcomqa](https://meta.discourse.org/u/appcomqa)
#### Post date: [September 20, 2019, 3:06pm UTC](https://meta.discourse.org/t/add-tags-500-error/129085/5 "2019-09-20T15:06:27Z")

</div>

I think I found this,

I am trying to re-import the database.

```
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
ERROR: could not create unique index "index_tags_on_lower_name"
DETAIL: Key (lower(name::text))=(棰ㄣ亴寮枫亸鍚广亜銇︺亜銈 is duplicated.
ERROR: could not create unique index "index_tags_on_name"
DETAIL: Key (name)=(棰ㄣ亴寮枫亸鍚广亜銇︺亜銈 is duplicated.
CREATE INDEX
CREATE INDEX
CREATE INDEX

```

How can I fix this.

---

<div class="post-metadata">

### Author: ![appcomqa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/appcomqa/32/133414_2.png) [@appcomqa](https://meta.discourse.org/u/appcomqa)
#### Post date: [September 20, 2019, 3:26pm UTC](https://meta.discourse.org/t/add-tags-500-error/129085/6 "2019-09-20T15:26:39Z")

</div>

Fix: I have reindex PostgreSQL ` index_tags_on_lower_name` and` index_tags_on_name`

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [October 20, 2019, 3:26pm UTC](https://meta.discourse.org/t/add-tags-500-error/129085/7 "2019-10-20T15:26:44Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
