Narrated Kab bin Malik:
I never failed to join Allah’s Apostle in any of his Ghazawat except in the Ghazwa of Tabuk. However, I did not take part in the Ghazwa of Badr, but none who failed to take part in it, was blamed, for Allah’s Apostle had gone out to meet the caravans of (Quraish, but Allah caused them (i.e. Muslims) to meet their enemy unexpectedly (with no previous intention).
Sahih Bukhari, Volume 5, Book59, Number 287