This is actually an ongoing plot in the current run. In an altered state of consciousness, Batman created a failsafe, literally called Failsafe, to kill himself if he ever killed someone else.
When the program sees an article that he killed someone (he didn’t, it was a setup), it releases the robot Failsafe to defeat him. Batman has yet to defeat Failsafe, though he has survived so far against it.
They're was a run where he's fighting an alternate universe Batman who is actually Thomas Wayne, from a universe where Bruce is the one that gets killed and Martha becomes the joker.