I ran into an issue in
FLINK-31773 where the passed exception handler relies on the leaderContender field of the DefaultLeaderElectionService. This field can become null with the changes of FLINK-31773. But the null check was missed in the error handling code. This bug wasn't exposed because FutureUtils.handleUncaughtException(..) expects the passed error handler callback to be bug-free.