The Book of Virtue, Enjoining Good Manners, and Joining of the Ties of Kinship
Ṣaḥīḥ Muslim 6562
مَا يُصِيبُ الْمُؤْمِنَ مِنْ شَوْكَةٍ فَمَا فَوْقَهَا إِلاَّ رَفَعَهُ اللَّهُ بِهَا دَرَجَةً أَوْ حَطَّ عَنْهُ بِهَا خَطِيئَةً
mā yuṣību al-muʾmina min shawkatin famā fawqahā illā rafaʿah Allāh bihā darajatan aw ḥaṭṭa ʿanhu bihā khaṭīʾatan
Transliteration generated from the Arabic vowel marks
The full narration
A'isha reported Allah's Messenger (ﷺ) as saying:A believer does not receive (the trouble) of running a thorn or more than that but Allah elevates him in rank or effaces his sins because of that
Source
Ṣaḥīḥ Muslim · 6562
Ṣaḥīḥ