ﷺ said, "I never stayed behind from any expedition that the Messenger of Allah ﷺ led, except for the expedition of Tabuk, though I had also stayed behind from the expedition of Badr. But no one was reproached for staying behind from Badr, since the Messenger of Allah ﷺ had only set out seeking the caravan of Quraysh, until Allah brought them and their enemy together without a prior appointment."
ﷺ قال: لم أتخلف عن رسول الله ﷺ في غزوة غزاها إلا فى غزوة تبوك، غير أنى تخلفت عن غزوة بدر، ولم يعاتب أحد تخلف عنها، إنما خرج رسول الله ﷺ يريد عير قريش، حتى جمع الله بينهم وبين عدوهم على غير ميعاد.
Bukhari narrated it in the Book of Military Expeditions (3951), and Muslim in the Book of Repentance (2769), both through Layth, from Aqeel, from Ibn Shihab, from Abdul-Rahman bin Abdullah bin Kaab, that Abdullah bin Kaab said, "I heard Kaab bin Malik say," and he related it as mentioned.The wording given is that of Bukhari. Muslim did not present his own wording for this chain, but rather referred back to the chain preceding it.