# Adding permalinks error

**URL:** https://meta.discourse.org/t/adding-permalinks-error/172009
**Category:** General
**Created:** [December 2, 2020, 5:09pm UTC](https://meta.discourse.org/t/adding-permalinks-error/172009 "2020-12-02T17:09:58Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Christian\_Suntay](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/christian_suntay/32/199290_2.png) [@Christian\_Suntay](https://meta.discourse.org/u/Christian_Suntay)
#### Post date: [December 2, 2020, 5:09pm UTC](https://meta.discourse.org/t/adding-permalinks-error/172009/1 "2020-12-02T17:09:58Z")

</div>

Error when I tried to add permalinks manually

 ![image](https://global.discourse-cdn.com/meta/original/3X/0/4/042b432156cefc2d6d78270bc7934a50f091e727.jpeg)

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [December 2, 2020, 5:25pm UTC](https://meta.discourse.org/t/adding-permalinks-error/172009/2 "2020-12-02T17:25:09Z")

</div>

I can reproduce that error if I add a value to the URL field that I’ve already created a permalink for. In that case, I think the form is working as expected, but the error message is not very informative.

Are you getting this error any time you try to add a permalink, or is it only happening with specific permalinks?

---

<div class="post-metadata">

### Author: ![Christian\_Suntay](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/christian_suntay/32/199290_2.png) [@Christian\_Suntay](https://meta.discourse.org/u/Christian_Suntay)
#### Post date: [December 2, 2020, 5:29pm UTC](https://meta.discourse.org/t/adding-permalinks-error/172009/3 "2020-12-02T17:29:43Z")

</div>

There is no same url created already and Any time i tried to add a permalink this error shows up ☹

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [December 2, 2020, 6:05pm UTC](https://meta.discourse.org/t/adding-permalinks-error/172009/4 "2020-12-02T18:05:27Z")

</div>

You almost certainly want to be creating permalinks from the console, not the web interface, with something like

```
Permalink.find_or_create_by(url: 'some/path/you/like', topic_id: 123)

```

That way it won’t matter if you call it multiple times.

Note that if you instead do:

```
Permalink.find_or_create_by(url: '/some/path/you/like', topic_id: 123)

```

it **will** fail on subsequent calls because it’ll strip the leading `/` before it does the create.

And if you really do want to delete/change paths that you created wrong the first time, you’d do something like

```ruby
p=Permalink.find_by(url: 'some/path/you/like')
p.destroy if p

```
