I went along with some men from the Ash-ariyin to Allah's Messenger (ﷺ) and it happened…

Sahih al-Bukhari Book 83 Hadith 57

Sahih al-Bukhari #6680

Oaths and Vows 83:57

Narrated Abu Musa Al-Ash`ari:

I went along with some men from the Ash-ariyin to Allah's Messenger (ﷺ) and it happened that I met him while he was in an angry mood. We asked him to provide us with mounts, but he swore that he would not give us any. Later on he said, "By Allah, Allah willing, if ever I take an oath (to do something) and later on I find something else better than the first, then I do the better one and give expiation for the dissolution of my oath."

Chapter: To swear something not in one's power; to swear to do an act disobedience; to take an oath in anger.

Grade: Sahih