# 422 fout bij herordenen categorie \[verbeter zichtbaarheid van ware fout 'ongeldige slug'\]

**URL:** https://meta.discourse.org/t/422-error-on-category-reorder-improve-visibility-of-true-error-invalid-slug/308571
**Category:** Bug
**Created:** [16 mei 2024 om 15:30 UTC](https://meta.discourse.org/t/422-error-on-category-reorder-improve-visibility-of-true-error-invalid-slug/308571 "2024-05-16T15:30:57Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![mbauman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mbauman/32/139835_2.png) [@mbauman](https://meta.discourse.org/u/mbauman)
#### Post date: [16 mei 2024 om 15:30 UTC](https://meta.discourse.org/t/422-error-on-category-reorder-improve-visibility-of-true-error-invalid-slug/308571/1 "2024-05-16T15:30:57Z")

</div>

Continued from: [Error 422 when reordering categories](https://meta.discourse.org/t/error-422-when-reordering-categories/270056)

I’m seeing the same error on our hosted instance ([discourse.julialang.org](http://discourse.julialang.org)) right now — we’d be happy to have some [@staff](https://meta.discourse.org/groups/staff) hop on over and repro!

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [16 mei 2024 om 17:15 UTC](https://meta.discourse.org/t/422-error-on-category-reorder-improve-visibility-of-true-error-invalid-slug/308571/3 "2024-05-16T17:15:56Z")

</div>

I can see this in your logs `ActiveRecord::RecordInvalid (Validation failed: Slug is invalid)`. Is there a particular category this triggers on?

* * *

Looking a bit more closely, it seems you may have a few categories without slugs. Not sure what the circumstances are there, but we’ll dig a bit deeper… 🙂

* * *

@mbauman More specifically, you had a category slug that was only numbers (2019) which didn’t pass the validation check (likely added after the category was created). I believe adjusting that has made everything come good. 👍

Does this sound like it could be the same for you @Christina?

---

<div class="post-metadata">

### Author: ![mbauman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mbauman/32/139835_2.png) [@mbauman](https://meta.discourse.org/u/mbauman)
#### Post date: [16 mei 2024 om 17:30 UTC](https://meta.discourse.org/t/422-error-on-category-reorder-improve-visibility-of-true-error-invalid-slug/308571/6 "2024-05-16T17:30:25Z")

</div>

Fascinating — yes, I was trying to move that category’s parent placement! Note that the placeholder text for the empty category slug still states that it’s optional:

![image](https://global.discourse-cdn.com/meta/original/4X/1/f/c/1fcd24d3bdf5d16e0734efb8da607c69d1ca42d4.png)

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [16 mei 2024 om 17:32 UTC](https://meta.discourse.org/t/422-error-on-category-reorder-improve-visibility-of-true-error-invalid-slug/308571/7 "2024-05-16T17:32:00Z")

</div>

I think those ones were a red herring and actually it was the ‘only numbers’ one that was the true culprit. 🙂 The empty ones seem quite happy now that’s been changed.

---

<div class="post-metadata">

### Author: ![mbauman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mbauman/32/139835_2.png) [@mbauman](https://meta.discourse.org/u/mbauman)
#### Post date: [16 mei 2024 om 17:32 UTC](https://meta.discourse.org/t/422-error-on-category-reorder-improve-visibility-of-true-error-invalid-slug/308571/8 "2024-05-16T17:32:45Z")

</div>

Yep, I just filled in the slugs and now was able to re-arrange things once again! Thanks!

---

<div class="post-metadata">

### Author: ![mbauman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mbauman/32/139835_2.png) [@mbauman](https://meta.discourse.org/u/mbauman)
#### Post date: [17 mei 2024 om 15:55 UTC](https://meta.discourse.org/t/422-error-on-category-reorder-improve-visibility-of-true-error-invalid-slug/308571/10 "2024-05-17T15:55:26Z")

</div>

Perhaps this could get moved back over to #Contribute > Bug now that the root cause is clear? In short, we had sub-categories named things like like “2020” without a filled-in slug — and then upon trying to move their parents we were getting this 422. Simply providing a customized slug fixed the issue. Seems there could now be some concrete bug fixes that could either make the error message more actionable or deal with it directly.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [18 mei 2024 om 23:08 UTC](https://meta.discourse.org/t/422-error-on-category-reorder-improve-visibility-of-true-error-invalid-slug/308571/11 "2024-05-18T23:08:07Z")

</div>

I can see another mention of it all the way back here:

> [@Reordering Categories Produces Error 422](https://meta.discourse.org/t/reordering-categories-produces-error-422/129948/14):
>
> This might be the problem. Do you have a category with a slug that is all numbers? If so, are you able to edit that category’s slug to something else?

It seems there were a few different cases mixed into that older #Contribute > Bug topic. The OP of this one may not have the same issue as yours.

Let’s split yours off neatly and suggest at least making the error message more obvious in the pop up.
