Hadithcore
Jami` at-Tirmidhi, 3038
sahih· Darussalam

Narrated Abu Hurairah:

"When the following was revealed: 'Whoever works evil will have the recompense of it... (4:123)' That worried the Muslims, so they complained about that to the Messenger of Allah (ﷺ) and he said: "Seek closeness and be steadfast, and in all that afflicts the believer there is atonement, even a thorn that pricks him, and the hardship he suffers."

حَدَّثَنَا مُحَمَّدُ بْنُ يَحْيَى بْنِ أَبِي عُمَرَ، وَعَبْدُ اللَّهِ بْنُ أَبِي زِيَادٍ الْمَعْنَى، وَاحِدٌ، قَالاَ حَدَّثَنَا سُفْيَانُ بْنُ عُيَيْنَةَ، عَنِ ابْنِ مُحَيْصِنٍ، عَنْ مُحَمَّدِ بْنِ قَيْسِ بْنِ مَخْرَمَةَ، عَنْ أَبِي هُرَيْرَةَ، قَالَ لَمَّا نَزَلَتْْ ‏:‏ ‏(‏مَنْ يَعْمَلْ سُوءًا يُجْزَ بِهِ ‏)‏ شَقَّ ذَلِكَ عَلَى الْمُسْلِمِينَ فَشَكَوْا ذَلِكَ إِلَى النَّبِيِّ صلى الله عليه وسلم فَقَالَ ‏

‏ قَارِبُوا وَسَدِّدُوا وَفِي كُلِّ مَا يُصِيبُ الْمُؤْمِنَ كَفَّارَةٌ حَتَّى الشَّوْكَةِ يُشَاكُهَا أَوِ النَّكْبَةِ يُنْكَبُهَا ‏

‏ ‏.‏ قَالَ أَبُو عِيسَى هَذَا حَدِيثٌ حَسَنٌ غَرِيبٌ ‏.‏ ابْنُ مُحَيْصِنٍ هُوَ عُمَرُ بْنُ عَبْدِ الرَّحْمَنِ بْنِ مُحَيْصِنٍ ‏.‏

References2 variants
In-Book Reference
Book 47, Hadith 90
English Reference
Vol. 5, Book 44, Hadith 3038