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
    image
  3. Click in, and click out. (I happened to do this by mistake)
  4. Try to submit the project : 500 error.

Log:

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!

Thanks!

3 Likes

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.

Hi,
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

Hi,

Thanks for taking time to look at it.

We are now at version 3.3.0.beta2-dev ( a564274ba2 ), dated April 20.

The 500 error is still there. Note that this has to be a new category, as per scenario and screenshot above, otherwise the field will indeed default to 0.

Yes, it does. But, that is if you figure out that “500 error” means that this specific field you clicked on while going through the form should be defaulted to 0. That is kind of unlikely, and honestly I’m not sure how I discovered it myself! :thinking: I was probably one second away from cancelling and starting the whole process from 0.

FYI: I tested also with UI the in English (US), and the result is the same.

1 Like

Yes, I can confirm that this result in a 500 on a new category and on the specific use case where I set focus to the tag input and then focus out of it without any changes.

Someone in our team will have a look shortly. Thanks!

1 Like

This PR will set the default value for the minimum required tags field to 0 which will resolve the problem.

5 Likes

This topic was automatically closed after 4 days. New replies are no longer allowed.