Huzaifa bin Yaman reported,

Nothing prevented me from being present at Badr except that I had set out together with my father Husayl. He said, the disbelievers of Quraysh seized us and said, "You intend to join Muhammad."We replied, "We do not intend to join him. We intend only to go to Medina."So they took from us a solemn pledge by Allah and His covenant that we would return to Medina and not fight alongside him. We then came to the Messenger of Allah ﷺ and informed him of what had happened.He said, "Go on to Medina. We will fulfill our pledge to them and seek Allah's help against them."

Muslim 4639

Sahih

و حدثنا أبو بكر بن أبي شيبة حدثنا أبو أسامة عن الوليد بن جميع حدثنا أبو الطفيل

حدثنا حذيفة بن اليمان قال

ما منعني أن أشهد بدرا إلا أني خرجت أنا وأبي حسيل قال فأخذنا كفار قريش قالوا إنكم تريدون محمدا فقلنا ما نريده ما نريد إلا المدينة فأخذوا منا عهد الله وميثاقه لننصرفن إلى المدينة ولا نقاتل معه فأتينا رسول الله ﷺ فأخبرناه الخبر فقال انصرفا نفي لهم بعهدهم ونستعين الله عليهم

مسلم 4639صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Jihad and expeditions
Chapter
Fulfilling the covenant
Numbering
Darussalam 4639
Muslim 4639