al-Bukhari has reported from the Hadith of 'Aishah (RA):
(Allah's Messenger (ﷺ) said) "If anyone vows to disobey Allah, then he must not disobey Him." (PT)
Reference (PT): Bulugh al-Maram 1387 (PT)
In-book reference (PT): Book 13, Hadith 14 (PT)
English translation (PT): Book 13, Hadith 1387 (PT)