422 error on category reorder [improve visibility of true error ‘invalid slug’]

Continued from: Error 422 when reordering categories

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

2 Likes

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… :slight_smile:


@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. :+1:

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

5 Likes

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

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

4 Likes

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

1 Like

Perhaps this could get moved back over to 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.

1 Like

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

It seems there were a few different cases mixed into that older 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.

1 Like