Ok Kiloa 안녕하세요, So in this case, when it just happened a moment or minute ago the one you'd use is "such a mistake has never happened before."
The first one: "such a mistake never happened before." is used more like if you were stating a fact. That that mistake never took place. (as if someone was saying it did when it really didn't) whether it was a past or present event.
Second: "such a mistake HAS never happened before" would imply, as you mentioned, that it happened recently but never before. Also, it is used when you are thinking of possible outcomes. Outcomes that would be the first time they ever happen. Example (using the mistake idea): "If you aren't careful you might make this mistake that HAS never been done before."
Third: "such a mistake HAD never happened before" implies that longer time has passed since that mistake and you are looking back, maybe telling the story to someone of what had occured.
Hopefully that made sense.