<p>I don't know the specific rules Craft uses but I believe Craft auto appends the <code>-1</code> when it tries to save an Element that has a matching URI in the <code>craft_elements_i18n</code> table.</p>

<p>A few scenarios that I can think of that may behave like you describe:</p>

<ol>
<li>Somehow, there is an existing record in your database that matches the URI of your Entry using the <code>cics-west-belden</code> slug</li>
<li>You have another Section, Category Group, or other custom Element set to generate URIs in the same format as the Section you are posting the Entry to which already has an Element saved using your <code>cics-west-belden</code> slug.</li>
</ol>

<p>To rule out the scenario where a matching record already exists in your database, open your database and look in the <code>craft_elements_i18n</code> table. Search for all records that match your slug and see if you only find the one:</p>

<pre><code>SELECT *
FROM craft_elements_i18n
WHERE slug = 'cics-west-belden';
</code></pre>

<p>To confirm that no other URIs already match your Entry, you could do a similar search in the URI table:</p>

<pre><code>SELECT *
FROM craft_elements_i18n
WHERE uri LIKE '%cics-west-belden%';
</code></pre>

CC BY-SA 3.0
2016-08-02T16:54:41.307Z
yeah for some reason this record exists in the mysql database but not showing up when I search in craft admin panel. Deleting it from the database directly using the mysql console worked great!
ChaiTea
CC BY-SA 3.0
2016-08-02T05:15:59.637Z
2016-08-02T05:15:59.637Z
Ben Parizek
<p>I have an entry slug like this: <code>cics-west-belden-1</code></p>

<p>the -1 seems to be auto appended to the slug, but there are no other entries with the project <code>cics-west-belden</code> in my project. When I remove the <code>-1</code> from the end of the slug and save, the <code>-1</code> always comes back. changing it to <code>cics-west-belden-2</code> saves works. Even changing it to <code>cics-west-belden-</code> works.</p>

<p>But as soon as I try to save it as  <code>cics-west-belden</code>, it changes back to <code>cics-west-belden-1</code> again. </p>

<p>Is this a bug with craft or maybe my database somehow got corrupted where it thinks this entry already exists when in fact it doesn't</p>

<database><slug><saveentry><bug>
Entry slug auto appends -1 even when the original slug is unique
# Entry slug auto appends -1 even when the original slug is unique

(Asked by: username_0 on 2016-08-02)

I have an entry slug like this: `cics-west-belden-1`

the -1 seems to be auto appended to the slug, but there are no other entries with the project `cics-west-belden` in my project. When I remove the `-1` from the end of the slug and save, the `-1` always comes back. changing it to `cics-west-belden-2` saves works. Even changing it to `cics-west-belden-` works.

But as soon as I try to save it as `cics-west-belden`, it changes back to `cics-west-belden-1` again.

Is this a bug with craft or maybe my database somehow got corrupted where it thinks this entry already exists when in fact it doesn't

**Tags:** database, slug, saveentry, bug

---

## 1 answers

### Answer by username_1 on 2016-08-02. Score: 4 | Accepted answer

I don't know the specific rules Craft uses but I believe Craft auto appends the -1 when it tries to save an Element that has a matching URI in the craft_elements_i18n table.
A few scenarios that I can think of that may behave like you describe:

Somehow, there is an existing record in your database that matches the URI of your Entry using the cics-west-belden slug
You have another Section, Category Group, or other custom Element set to generate URIs in the same format as the Section you are posting the Entry to which already has an Element saved using your cics-west-belden slug.

To rule out the scenario where a matching record already exists in your database, open your database and look in the craft_elements_i18n table. Search for all records that match your slug and see if you only find the one:
SELECT *
FROM craft_elements_i18n
WHERE slug = 'cics-west-belden';

To confirm that no other URIs already match your Entry, you could do a similar search in the URI table:
SELECT *
FROM craft_elements_i18n
WHERE uri LIKE '%cics-west-belden%';

> **Comments:**
> **username_0**: yeah for some reason this record exists in the mysql database but not showing up when I search in craft admin panel. Deleting it from the database directly using the mysql console worked great!  

---

