Topics failing validation after migration throw '422' error instead of "nice" message

When data is migrated from another software platform it is possible that topics migrated would be considered “invalid” if created on Discourse. Common causes of “invalid” topics are min topic title length, max topic title length, and title max word length. If a user attempts to edit these topics (including changing category) they receive a 422 error, instead of the standard Title seems unclear, is it a complete sentence?.

Further, it’d be great if we could share the specific cause of the error (word is too long, for example) instead of the vague “title seems unclear”.


Do they also get 422 if they edit the title? Or is this specific to changing category?

1 Like

I’m not able to consistently reproduce this on try, so I’m not sure. I created a topic with a 28 character word in the title (limit is 30), submitted, waited 5 minutes, lowered the site setting to a 20 character limit, then changed the category without error (which should have failed?). Attempting to add to the title gave the expected Title seems unclear, is it a complete sentence? error. If I modified the title and changed the category I received a 422 error, but this is not consistent with what I first saw.

So as suspected this has to do with category only edits triggering validation on the title. So only the topic owner, staff, or TL3 could really run into this.

1 Like

I can confirm this behaviour. We imported all topics into “uncategorized” and are now gradually recategorizing them. I just bumped into that 422 error. After reading this topic, I changed the title to make it comply with the minimum length and it worked. But it would obviously be nicer to have a meaningful error message, even if it just pointed into a general direction like “Topic failed validation. Does the title meet requirements?”. Even better would be to not produce an error at all and continue to allow non-compliant topic titles even when they are moved.