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