Improve protocol mismatch error handling.