Jundab reported: The Messenger of Allah, peace and blessings be upon him, said, “A man said: By Allah, Allah will not forgive this person! Allah Almighty said: Who is he who swore by me that I will not forgive someone? I have forgiven him and nullified your good deeds.”
Source: Ṣaḥīḥ Muslim 2621
Grade: Sahih (authentic) according to Muslim
عَنْ جُنْدَبٍ قَالَ قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ أَنَّ رَجُلاً قَالَ وَاللَّهِ لاَ يَغْفِرُ اللَّهُ لِفُلاَنٍ وَإِنَّ اللَّهَ تَعَالَى قَالَ مَنْ ذَا الَّذِي يَتَأَلَّى عَلَىَّ أَنْ لاَ أَغْفِرَ لِفُلاَنٍ فَإِنِّي قَدْ غَفَرْتُ لِفُلاَنٍ وَأَحْبَطْتُ عَمَلَكَ2621 صحيح مسلم كتاب البر والصلة والآداب باب النهي عن تقنيط الإنسان من رحمة الله تعالى