Can't Grant Badge - Generic Error

AI-generated summary

Users reported an issue granting badges in Discourse, encountering a vague “Sorry, an error has occurred” message. dylanh724 noted the problem persisted even after upgrading, despite no special badge configuration. sam clarified that the “reason” field expects a link to a post or topic, not free text like “Backer!”, and suggested improving the error message. dylanh724 confirmed the workaround — leaving the field blank — worked, and proposed UX improvements: renaming “reason” to “Topic URL” and replacing the generic error with “Invalid Topic URL”. A small UI hint was also noted as easy to miss. saurabhp referenced a prior fix to validate the reason field and submitted a PR to surface clearer errors to users. The issue was later confirmed resolved saurabhp, with the backend now rejecting invalid reasons and displaying appropriate feedback. sam invited community contributions to further improve error messaging. notriddle noted they couldn’t reproduce the error, suggesting inconsistent behavior across instances.

When I try to grant a badge:

I used to be able to grant badges fine. Tons of people have this very badge – I tried to grant a random badge to myself, too, and still getting a vague error.

Nothing special about this badge - no sql or anything. It’s just a badge I manually add.

Prob related to this: https://meta.discourse.org/t/badges-no-longer-visible-1-9-0-b4/66979/2?u=hawk

إعجاب واحد (1)

Our error message can be TONS better here, so leaving this open.

But the problem here is that it is expecting a link to a post or topic per the text at the bottom.

There was also a bug in badges that was fixed, try latest

5 إعجابات

Probably not this bug – I just found time to upgrade and it’s still doing it:

image

Wait, reason can not be “Backer!”, paste a link to a topic there or a topic id.

إعجاب واحد (1)

That’s not for generic notes? Should really ask for a “topic url” instead of “reason”, if that’s the case. Super misleading~ Thanks, I’ll try it!

EDIT: Worked by leaving it blank.

Suggested changes:

  1. Change “reason” to “Topic URL”
  2. Catch “Sorry, an error has occurred” to “Invalid Topic URL”

EDIT 2: Oh, I just saw this –

image

Heheh… maybe a little bigger. Several people responded here not noticing, either.

إعجاب واحد (1)

pr-welcome for improving the error message.

إعجابَين (2)

I can’t reproduce this; it seems like Discourse just ignores invalid Reasons instead of producing an error…

Change to send an error from backend if the reason was not valid was done here:

I have made the change to show the corresponding message to the user here. This needs to be reviewed:
https://github.com/discourse/discourse/pull/6801

7 إعجابات

This is fixed now. It can be closed. :smile:

4 إعجابات