The Messenger of Allah ﷺ said, "There is no vow and no oath regarding what the son of Adam does not possess, nor in disobedience to Allah, nor in severing ties of kinship. Whoever swears an oath and then sees that something else is better than it, let him abandon it and do what is better, for abandoning it is its expiation."
حدثنا المنذر بن الوليد حدثنا عبد الله بن بكر حدثنا عبيد الله بن الأخنس
قال رسول الله ﷺ لا نذر ولا يمين فيما لا يملك ابن آدم ولا في معصية الله ولا في قطيعة رحم ومن حلف على يمين فرأى غيرها خيرا منها فليدعها وليأت الذي هو خير فإن تركها كفارتها
[Hasan]. Bayhaqi narrated it, 10/33, 34, from the hadith of Abu Dawud through him, and Nasai narrated it, no. 3823, from the hadith of Ubaydullah bin Akhnas through him, in a shortened form. See the previous hadith.Yahya bin Ubaydullah is matruk, and his hadith is found in Bayhaqi, 10/33, 34.