Sahih Muslim 1787
It has been reported on the authority of Hudbaifa b. al-Yaman who said:
Nothing prevented me from being present at! he Battle of Badr except this incident. I came out with my father Husail (to participate in the Battle), but we were caught by the disbelievers of Quraish. They said: (Do) you intend to go to Muhammad? We said: We do not intend to go to him, but we wish to go (back) to Medina. So they took from us a covenant in the name of God that we would turn back to Medina and would not fight on the side of Muhammad (ﷺ). So, we came to the Messenger of Allah (ﷺ) and related the incident to him. He said: Both, of you proceed (to Medina) ; we will fulfil the covenant made with them and seek God's help against them.
وَحَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، حَدَّثَنَا أَبُو أُسَامَةَ، عَنِ الْوَلِيدِ بْنِ جُمَيْعٍ، حَدَّثَنَا أَبُو الطُّفَيْلِ حَدَّثَنَا حُذَيْفَةُ بْنُ الْيَمَانِ، قَالَ مَا مَنَعَنِي أَنْ أَشْهَدَ، بَدْرًا إِلاَّ أَنِّي خَرَجْتُ أَنَا وَأَبِي - حُسَيْلٌ - قَالَ فَأَخَذَنَا كُفَّارُ قُرَيْشٍ قَالُوا إِنَّكُمْ تُرِيدُونَ مُحَمَّدًا فَقُلْنَا مَا نُرِيدُهُ مَا نُرِيدُ إِلاَّ الْمَدِينَةَ ‏.‏ فَأَخَذُوا مِنَّا عَهْدَ اللَّهِ وَمِيثَاقَهُ لَنَنْصَرِفَنَّ إِلَى الْمَدِينَةِ وَلاَ نُقَاتِلُ مَعَهُ فَأَتَيْنَا رَسُولَ اللَّهِ صلى الله عليه وسلم فَأَخْبَرْنَاهُ الْخَبَرَ فَقَالَ ‏
"‏ انْصَرِفَا نَفِي لَهُمْ بِعَهْدِهِمْ وَنَسْتَعِينُ اللَّهَ عَلَيْهِمْ ‏"‏ ‏.‏