# Error 422 when reordering categories

**URL:** https://meta.discourse.org/t/error-422-when-reordering-categories/270056
**Category:** Support
**Created:** [June 29, 2023, 5:07pm UTC](https://meta.discourse.org/t/error-422-when-reordering-categories/270056 "2023-06-29T17:07:47Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Christina](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@Christina](https://meta.discourse.org/u/Christina)
#### Post date: [June 29, 2023, 5:07pm UTC](https://meta.discourse.org/t/error-422-when-reordering-categories/270056/1 "2023-06-29T17:07:47Z")

</div>

Good morning,

Discourse version 3.1.0.beta4  
I’m trying to reorder the categories from the UI and when I press save order I get a 422 error. Interesting fact: my categories on the main Discourse page doesn’t have the same order on the reorder categories page.  
Example : I have the supervisor category at position 4 on my main page, on the other hand when I go on the reorder categories page, the supervisor category is not at position 4, but at position 23 and if I press on save , it will go to position 23 as shown in the reorder categories page. I have the 422 error that appears, but there are still changes that have taken place.  
Last week I had no problems with the reorganization, I only had this problem when I moved the new category my script created today to the first position.  
In the preview page of Chrome I have a little more details about the error:  
The change you wanted was rejected. Maybe you tried to change something you didn’t have access to.

 ![preview error](https://global.discourse-cdn.com/meta/original/4X/6/e/c/6ecf986cc46b399eb9674fa420c4342747544153.png)

I’m admin, so I shouldn’t get this error.  
In the source code I have this exception that throws :  
SyntaxError: Unexpected token ‘\<’ "\<!DOCTYPE "… is not a valid JSON

 ![error in code](https://global.discourse-cdn.com/meta/original/4X/d/c/2/dc2107c7c73f9aeea8419a2c5cff9cc2ef86af5a.png)

I’ve:  
Done a server reboot  
Enabled Allow Uncategorized Topic option

Do you have an idea what I could do ?

---

<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: [July 18, 2023, 7:29pm UTC](https://meta.discourse.org/t/error-422-when-reordering-categories/270056/3 "2023-07-18T19:29:17Z")

</div>

I’m afraid I can’t replicate this on my test site. When I change the order of the categories they reorder without any error.

> [@Christina](#):
>
> I only had this problem when I moved the new category my script created today to the first position.

Could it be something to do with how you’ve created this category outside of the UI?

---

<div class="post-metadata">

### Author: ![Christina](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@Christina](https://meta.discourse.org/u/Christina)
#### Post date: [July 20, 2023, 1:21pm UTC](https://meta.discourse.org/t/error-422-when-reordering-categories/270056/4 "2023-07-20T13:21:43Z")

</div>

Maybe, but I’ve done lots of categories this way and never had an issue. I did it through the API. I know that one of my categories had a name too long and my script was not able to create it, do you think it could be the issue ?

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [July 20, 2023, 2:20pm UTC](https://meta.discourse.org/t/error-422-when-reordering-categories/270056/5 "2023-07-20T14:20:43Z")

</div>

You could try output your category data via the rails console or [data explorer](https://meta.discourse.org/t/32566?silent=true), and see if there’s anything weird in it. 🤔

---

<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: [September 5, 2023, 10:22pm UTC](https://meta.discourse.org/t/error-422-when-reordering-categories/270056/6 "2023-09-05T22:22:01Z")

</div>

I’ve slipped this over to #Support as we couldn’t get a clear repro.

Did you manage to resolve this in the end?

---

<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: [May 18, 2024, 11:12pm UTC](https://meta.discourse.org/t/error-422-when-reordering-categories/270056/7 "2024-05-18T23:12:05Z")

</div>

11 posts were split to a new topic: [422 error on category reorder [improve visibility of true error ‘invalid slug’]](https://meta.discourse.org/t/422-error-on-category-reorder-improve-visibility-of-true-error-invalid-slug/308571)
