Abu Hurairah reported,

The Prophet ﷺ said, "Sulayman bin Dawud, the prophet of Allah, said, 'Tonight I will go around to seventy wives, each of whom will bear a son who will fight in the path of Allah.'His companion, or the angel, said to him, 'Say, If Allah wills.'But he did not say it and forgot. None of his wives became pregnant except one, who delivered half a child."The Messenger of Allah ﷺ said, "Had he said, 'If Allah wills,' he would not have broken his oath, and it would have helped him achieve what he wanted."In another narration, "Had he made the exception."

Azami 7097

Sahih

عن أبي هريرة

عن النبي ﷺ قال: قال سليمان بن داود نبي الله: لأطوفن الليلة على سبعين امرأة، كلهن تأتي بغلام يقاتل في سبيل الله، فقال له صاحبه أو الملك: قل: إن شاء الله، فلم يقل ونسي، فلم تأت واحدة من نسائه إلا واحدة جاءت بشق غلام، فقال رسول الله ﷺ: لو قال: إن شاء الله لم يحنث، وكان دركا له في حاجته وفي رواية: لو كان استثنى

الأعظمي 7097صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Oaths and vows
Chapter
Faith
Section
Exception in oaths
Numbering
Jami al-Kamil 7097 (2nd edition)
Azami 7097