On Dataverse 4.18.1, when I try to replace a file with another file that has the same content (same md5), I'm not immediately getting the error message that "You cannot replace a file with the exact same file.":

There's no messaging that the replace didn't work or why.
But if I then try to replace the file with a file that does not have the same content, the replace succeeds, and the error message that should have appeared when the replace failed the first time appears here:

So it's like the error message for failed attempts only appears once a successful attempt as been made.