500 error when creating a category with empty minimum tags field

Reproduction steps:

  1. Create a new category
  2. In the tags setting, notice that the minimal number of tags is empty
  3. Click in, and click out. (I happened to do this by mistake)
  4. Try to submit the project : 500 error.


Failed to handle exception in exception app middleware : ActiveRecord::NotNullViolation : PG::NotNullViolation: ERROR:  null value in column "minimum_required_tags" of relation "categories" violates not-null constraint
DETAIL:  Failing row contains (110, BON Development, 231F20, null, 0, 2024-03-07 14:38:58.055217, 2024-03-07 14:38:58.055217, 12, 0, 0, 0, bon-development, null, FFFFFF, t, null, 0, null, null, 106, null, 0, 0, 0, null, f, 0, 0, t, bon development, f, null, null, null, null, null, null, t, f, f, 3, null, rows_with_featured_topics, all, f, null, f, 0, f, null, null, all, f, null, null, null).

Expectation, two options:
A: Field should default to 0, whether we click on it or not.
B: The error message should clearly point to the problematic field.

The logs saved the day, because I could see the problematic field and put a 0 in it. But only admins have access to the logs!



Are you on latest Discourse? I can’t reproduce this locally. Once I empty the minimum tags field and press save, it gets reset to zero again (and no 500 error is generated when saving.

I’m on version 3.3.0.beta1-dev (9b9ff3e10a), Jan 31 2024. Not the latest.

Once I empty the minimum tags field

In my case for a new category I didn’t need to empty it, it was already empty. Just click in click out.

I will try updating, but since we have users around the globe, it creates a downtime. Or maybe I missed the way to do a hot update?

1 Like

In my test, the field defaults to 0, in part because after a recent update, it is now a number type field. If you manually set it to 0, does it then save the category for you? That may be a way to avoid updating right away (and still making the other change you were looking to make to the category settings).

1 Like