"Category is reserved"


(Michael - DiscourseHosting.com) #1

One of our customers has an issue. Since a few days (maybe since update to v0.9.9.2) users cannot post in a certain category any more. When they try, an error pops up ‘Category is reserved’, and the server returned “422 Unprocessable entity”

We can’t even find where the string is_reserved is used in the code.

Admins can post to that category. There are no special settings. Security is ‘users can create/reply/see’.


(Sam Saffron) #2

We have seen this bug at one of our customers as well, we were unable to reproduce on local restore.

I am curious if a redis flush makes it go away.


(Michael - DiscourseHosting.com) #3

Thanks.
Just tried that, and it doesn’t…


(Sam Saffron) #4

This must be coming from rails core or a gem we depend on.


(Kane York) #6

Selected matches from a grep -R:

vendor/bundle/ruby/2.0.0/gems/rails-4.0.4/guides/source/active_record_validations.md
line 340:    message: "%{value} is reserved." }

vendor/bundle/ruby/2.0.0/gems/fog-1.18.0/lib/fog/aws/requests/compute/delete_security_group.rb
line 45:            raise Fog::Compute::AWS::Error.new("InvalidGroup.Reserved => The security group 'default' is reserved")

vendor/bundle/ruby/2.1.0/gems/activemodel-4.0.4/lib/active_model/locale/en.yml
line 10:      exclusion: "is reserved"

config/locales/server.en.yml
line 29:  is_reserved: "is reserved"

I’m leaning towards match #1, because that popup is showing the messages from the ActiveRecord errors object.


(Sam Saffron) #7

Yeah, must be AR, what is that validation?


(Régis Hanol) #8

As far as I know “is reserved” is used in :exclusion validations which is only used in topics.


(Sam Saffron) #9

I am betting SiteSetting.allow_uncategorized_topics is set to false here.


(Régis Hanol) #10

Yes it’s set to false.


(Kane York) #11

So it’s another case of the uncategorized category going wacko?


(Régis Hanol) #12

Which is weird 'cause it’s happening on another category.


(Sam Saffron) #13

It must be that crazytown validation, maybe pull it out and write it in a saner way?


(Régis Hanol) #14

What’s super weird is that I can’t reproduce that locally with the same data. Something might be different in production mode.


(Sam Saffron) #15

Just fixed it:

https://github.com/discourse/discourse/commit/759f4b4fe92bdf74107ad38a00de57ec1a2cfb2e

We an issue specific to multisite, the validation was not looking up the category_id of uncategorized per-site, there is no parity across sites for uncategorized category id.


(Sam Saffron) #16

This topic was automatically closed after 24 hours. New replies are no longer allowed.