NIDREI SHEGAGOS AND SHEVU'OS SHEGAGOS [Nedarim: Shegagah]
Gemara
(Mishnah): The following are Nidrei Shegagos (mistaken vows): One said 'if I ate or drank (I forbid...)', and later he remembered that he had done so;
'If I will eat or drink (I forbid...)', and later he forgot that he said this and ate or drank. 'I forbid my wife to benefit from me, for she stole my wallet or hit my son', and later he learned that she did not.
(Beraisa): Just like Nidrei Shegagos are permitted, also Shevu'os Shegagos.
Shevu'os Shegagos are like the case of Rav Kahana and Rav Asi.
Shevu'os 26a (Beraisa): "Ha'Adam bi'Shvu'ah" excludes Ones, i.e. a case like that of Rav Kahana and Rav Asi:
They argued about what Rav had said. Each swore that he was right. Later, Rav confirmed what one said. The other was worried about his false oath.
Rav: Don't worry. This was Ones. (You swore what you believed was the truth.)
Nedarim 66a (Mishnah): If one said 'I will not marry Plonis, because she is ugly', and she is actually pretty, or 'because she is black (or short)', and she is really white (or tall); he is permitted;
This is not because she was ugly or black or short, and she became pretty or white or tall. Rather, the vow was a mistake from the beginning.
A case occurred in which Reuven vowed not to marry his sister's daughter. They took her to R. Yishmael's house and prettied her up. Reuven said that he did not vow from this girl, and R. Yishmael permitted the vow.
Question: The case brought contradicts what (we may infer from what) the Mishnah taught (that if she was ugly and became pretty, he is forbidden)!
Answer: The Mishnah is abbreviated. It means as follows. R. Yishmael says, even if an ugly girl became pretty, or a black or short girl became white or tall, the vow is permitted. A case occurred...
Gitin 35a (Rav Kahana): A man once deposited a gold coin with a widow during a famine year. She put it in the flour; it got baked into a loaf, and she gave the loaf to a poor man. When the depositor asked for his coin, she swore that she did not benefit from it, and that one of her children should die if she is lying. Soon after, one of her children died.
She was punished because she benefited from the coin. (It saved her flour that otherwise would have been used in the loaf she gave to the poor man.)
Rishonim
The Rif and Rosh (Nedarim 3:7,8) bring the Mishnah and Gemara verbatim.
Rosh: Regarding Shevu'as Shegagos, if he said 'this produce is forbidden (if I am wrong)', the produce is permitted.
Korban Nesan'el (3): The Rosh holds that 'the four kinds of oaths are permitted' means that if he forbade something through such an oath, it is permitted.
Tosfos (Shevu'os 26a): Rav told his Talmid that there is no punishment at all for his false oath, since he believed that he was swearing truthfully.
Rambam (Hilchos Shevu'os 3:5,6): One is exempt for Shevu'os Shegagos. This can be for Shevu'as Shav (vain), e.g. he swore not to wear Tefilin because he did not know that it is a Mitzvah. It can be Shevu'as Sheker, e.g. he swore that he did not eat, and later he remembered that he ate, or he swore that he will not eat, and later he forgot and ate. Or, he swore that his wife may not benefit from him, for she stole his wallet or hit his son', and later he learned that she did not.
Rambam (Hilchos Nedarim 4:1): Nidrei Shegagos are permitted just like Shevu'os Shegagos.
Rosh (Shevu'os 3:13): Even though the woman who swore that she did not benefit from the coin thought that she swore truthfully, she should have been more careful, for she knew that she will need to swear if it will be lost.
Ran (25b DH u'Veis Hillel): When a man saw people eating his fruits, and forbade them through a vow, and later he saw that his father was among them, his father is permitted. There is a mistake in the vow itself. This is unlike 'I forbid my wife to benefit from me.' If he did not say 'because she stole my wallet', it takes effect, even though he vowed only because he (mistakenly) thought that she did. There, he intended to forbid her; the mistake is not in the Neder itself.
Poskim
Shulchan Aruch (YD 232:6): Nidrei Shegagos are permitted. E.g. he said 'this loaf is Konam if I ate or drank', and later he remembered that he ate or drank. Or, '(it will be forbidden) if I will eat or drink', and later he forgot and ate or drank. Since he was Shogeg at the time he said the vow or when it should have taken effect, and had he known this he would not have vowed, it is not a vow.
Beis Yosef (DH Nidrei): Since he did not intend to vow (i.e. had he been informed, he would not have vowed), his mouth and heart are divided. We learn from Shevu'os that one must be aware at the time the Shevu'ah takes effect.
Taz (10): It is permitted because he said that this is why he vows. Had he not said so, he would need to ask a Chacham to permit the vow.
Shulchan Aruch (ibid.): The same applies if he said 'Konam, my wife may not benefit from me, for she stole my wallet', and later he learned that she did not. The same applies if one said 'Konam, I will not marry Plonis, because she is ugly', and she was pretty at the time. Had he known, he would not have vowed. However, if she was ugly and they made her pretty, the vow took effect.
Rema: Similarly, if Levi vowed to give 1000 Zuz to Tzedakah if Ploni was involved in a certain matter, and he was, Levi is exempt, for it is a Neder b'Shogeg.
Taz (12): Similarly, if two argued about a certain matter, and they shook hands and agreed that whoever is right will get a certain sum of money from the other, the one who erred is exempt, because he was Shogeg. We learn from Rav Kahana and Rav Asi. Any error is considered Ones, so he is not liable. Even though one opinion in the Rema (CM 203:10) says that two people can swap all their property, there they intended for this, even though they were unsure how much the other has. Here, each thought that he knew.
Shulchan Aruch (239:1): Just like Nidrei Shegagos are permitted, also Shevu'os Shegagos are permitted.
Shulchan Aruch (239:16): Since Nidrei Shegagos are permitted, if one swore not to eat this if Ploni said this matter, and it was found that he said it, the loaf is permitted. Similarly, if he swore not to eat loaf A if he will eat loaf B, and later he forgot and ate loaf B, A is permitted.