I have just flagged an answer. I shouldn't be able to flag it again, but the Flag button is still visible. I can click it, choose any flag reason and click Flag answer. This is when I will be shown the message:
You have already flagged this post
This is clearly some poor UX design. The best (IMO) solution would be to disable Flag button when it shouldn't be available and add an on-hover tooltip with identical message.
If this is not desired for some reason (for example checking issued flags is expensive and would significantly affect performance), then the check should be performed when user clicks the Flag button.