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