For messages you don't expect mere mortals to solve, error codes may be useful as a filter. Some Windows Update errors can't be fixed without a reboot (or a debugger and the Windows source code) so 0xdead1337 is a fine code. You can Google it if you want to try anyway.
Sometimes, errors happen because a whole chain of behaviour failed. The program is in a bad, irrecoverable state or contains a bug. The user can't fix it and the programmer that made the method may not even know the state can be impossible (i.e. code has been refactored).
Sometimes, error codes are more about helping the developers pinpoint a bug than they're about helping the user.
That said, things like "database corrupt" or "no connection to API server" should just be displayed rather than muffled away.
In my opinion, these impossible error codes should be accompanied with a support phone number or email address.