We ran into an issue while setting up our Discourse forum. We were trying to grant Moderator permission to an account we created for our Sales team, but kept receiving a
I went through our error logs and this was showing up:
ActiveRecord::RecordInvalid (Validation failed: Name must be at least 6 characters) /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-126.96.36.199/lib/active_record/validations.rb:79:in `raise_record_invalid'
We had modified the min username length to 6 instead of the default 3 when first going through the setup since that is the length we want to require. Once I reset the field to 3 I was able to add/remove the Moderator permissions. I did some testing and found that I could change min username length anywhere from 1-5 and it did not cause an issue, but as soon as it was set to 6 or greater it broke granting or removing Admin/Moderator permissions.
This didn’t make sense to me since we only had 6 Users and all of their usernames were 6 characters or more. I looked through the rest of our forum to see if there was anything that would be related specifically to Moderators/Admins and had a name that was less than 6 characters. The staff Group is the only thing that I’ve been able to find that meets those criteria. And since it is 5 characters that may be the reason that I can set min username length up to 5 and not cause any issues. This definitely seems like something is not connected correctly within the system.
I found a couple of Topics here with similar issues:
The ‘solution’ to both of those issues was to just reset min username length to the default value, which is just a workaround not an actual fix for the issue.
Other than this issue the rest of the setup has been a breeze. Thanks for the great product.