The Prophet ﷺ said, "No fatigue, illness, anxiety, sorrow, distress, or harm befalls a Muslim, not even a thorn that pricks him, except that Allah expiates some of his sins through it."
حدثنا أبو عامر حدثنا زهير عن محمد بن عمرو بن حلحلة عن عطاء بن يسار
أن النبي ﷺ قال ما يصيب المرء المسلم من نصب ولا وصب ولا هم ولا حزن ولا غم ولا أذى حتى الشوكة يشاكها إلا كفر الله عز وجل بها من خطاياه
Its isnad is sahih. Muhammad bin Amr bin Halhala Ad-Dayli is trustworthy, and the hadith was mentioned earlier from Abu Hurairah. It is found in Bukhari 10/103, no. 5642, Fath al-Bari, in the chapter on illness, what has been said about the atonement of illness, similar to Ahmad, and in Muslim 4/1993, no. 2573, in the chapter on righteousness, the reward of the believer for what befalls him, and in Tirmidhi, in the chapter on funerals, 3/289, no. 966, where he graded it hasan.