There a similar problem when clicking the number of votes in a post as an anonymous user. You get this error message:
An error occurred: You need to be logged in to do that.
Not an error but intended design.
“to do that” is a vague description.
Actually, maybe the solution is not a dialog at all but a link to log in? This is what happens when clicking any other option (i.e. upvoting) and it makes total sense.