But a wholly non-funny "Invariant Violated" message would be no better. The problem isn't that the message is funny, but that it does not contain the information you need to understand what's going on. The whimsy is just a distraction.
They don't hurt, and it's fun to come across them. If the funny thing is used in one place, it can be memorable and easier to search for. If it's the equivalent of "error [error]" or whatever, I honestly don't care.
Doesn’t matter. The important thing is that I can look them up or resolve them easily. Without looking it up can you tell me the difference between HTTP 451 and 510? If not they’re no more useful than I’m a teapot. But I can identify both of those uniquely and figure out where they’re coming from.
This is a great example where humor can help: I love http.cat because the whimsy makes it easier to look up and remember status codes. Not exactly the same as jokes in code, but an example of how more humor can be better than less humor for practical, human-factors reasons.