2,661. An Oath Not to Perform a Mitzvah
Hilchos Shevuos 5:14
If a person takes an oath not to eat a certain loaf followed by oath to eat it, his second oath is a vain oath because he’s already forbidden to eat it. He is therefore liable to lashes for the second oath regardless of whether or not he actually eats it. If he does eat it, then he’s separately liable for not fulfilling an oath of expression. Similarly, if a person takes an oath to ignore a certain mitzvah and then he doesn’t ignore it, he is not liable for breaking an oath of expression, though he is liable to lashes for making a vain oath. One must perform a mitzvah that he took an oath to ignore.
Hilchos Shevuos 5:15
Pursuant to the previous halacha, if someone took an oath not to build a succah, not to put on tefillin or not to give tzedaka, he is liable to lashes for making a vain oath. The same is true if one takes an oath for another person that he won’t present testimony that he has, or that he won’t testify if he finds something out, because he is obligated to testify. Similarly, if one person tells another that he’s taking an oath that he will never know testimony about him, it’s a vain oath because he can’t control whether or not he’ll ever know testimony regarding the other person. The same is true in all comparable cases.