Jundub bin 'Abdullah (May Allah be pleased with him) reported:
The Messenger of Allah (ﷺ) said, "Once someone said: 'By Allah! Allah will not forgive such and such (a person).' Thereupon Allah, the Exalted and the Glorious, said: 'Who is he who takes an oath in My Name that I will not grant pardon to so-and-so? I have granted pardon to so-and-so and rendered your good deeds fruitless."'[Muslim]. (ES)
App reference (ES): Book 18, Hadith 66 (ES)
Arabic/English book reference (ES): Book 18, Hadith 1576 (ES)