Repro on Meta:
- go to user admin page
- click on Edit badges
- assign a badge adding an external URL as Reason
- click Grant
- the badge is assigned, the Reason field remains empty
The admin should be warned that the URL is invalid (is not an internal URL) and clicking on Grant must produce the error
Sorry, an error has occurred (btw a specific error is always better to identify where you are wrong).