The Messenger of Allah ﷺ said, "Whoever swears an oath and says, 'If Allah wills,' has made an exception for himself."
حدثنا العباس بن عبد العظيم العنبري حدثنا عبد الرزاق أنبأنا معمر عن ابن طاوس عن أبيه
قال رسول الله ﷺ من حلف فقال إن شاء الله فله ثنياه
No references are available.
Sourcing, its chain is sahih. Tirmidhi transmitted it in the Book of Vows and Oaths, chapter on making an exception in an oath, hadith 1532, from the hadith of Abdul-Razzaq, with the same wording and some additional remarks. It is also found in Musannaf Abdul-Razzaq, hadith 16118, and Ibn Hibban graded it sahih (Mawarid), hadith 1185, and it has a corroborating witness.