Sahih Muslim Book 45, Hadith 63
Allah's Messenger (ﷺ) said: There is no trouble that comes to a believer except that it obliterates from his sins, even if it is the pricking of a thorn
The above hadith has been transmitted by Hisham with the same chain.
No trouble comes to a believer even if it is the pricking of a thorn that it becomes (the means) whereby his sins are effaced or his sins are obliterated. Yazid says: He does not know which word 'Urwa said (whether he said Qussa or Kuffira).