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." (JA)
Reference (JA): Bulugh al-Maram 1387 (JA)
In-book reference (JA): Book 13, Hadith 14 (JA)
English translation (JA): Book 13, Hadith 1387 (JA)