When Hashem Does Not Let a Tzaddik Err
The Ben Ish Chai, in his sefer of commentaries on Aggados HaShas, cites Rav Avrohom Palagi, who told the following.
There was a dispute between Rav Yosef Karo, the Beis Yosef and author of the Shulchan Aruch, and the Rema, Rav Moshe Isserles, about whether an aguna may remarry. The Rema permitted her to remarry, while the Beis Yosef had forbidden it.
The heavenly maggid who taught the Beis Yosef revealed to him that he had in fact been correct at first. Her husband was still alive, and she was forbidden to remarry. But, the maggid explained, the moment the holy Rema ruled that she was permitted, her husband passed away, and this released her. Hashem does not allow tzaddikim to err, so He saved the Rema from a mistake. As soon as he wrote his psak, the husband died and the woman was permitted to remarry.