The Messenger of Allah ﷺ said, "Whoever vows to obey Allah, let him obey Him, and whoever vows to disobey Allah, let him not disobey Him."
حدثنا أبو بكر بن أبي شيبة حدثنا أبو أسامة عن عبيد الله عن طلحة بن عبد الملك عن القاسم بن محمد
قال رسول الله ﷺ من نذر أن يطيع الله فليطعه ومن نذر أن يعصي الله فلا يعصه
Bukhari narrated it in Kitab al-Ayman wal-Nudhur, chapter, "The vow to do an act of obedience, and 'whatever you spend or vow, [Allah knows it]'," 6696, from the hadith of Talha in this manner.