Sahih al-Bukhari 3463
Narration text is preserved in its supplied Arabic and English. Translated interfaces and reading guides do not add narration translations in other languages.
كَانَ فِيمَنْ كَانَ قَبْلَكُمْ رَجُلٌ بِهِ جُرْحٌ، فَجَزِعَ فَأَخَذَ سِكِّينًا فَحَزَّ بِهَا يَدَهُ، فَمَا رَقَأَ الدَّمُ حَتَّى مَاتَ، قَالَ اللَّهُ تَعَالَى بَادَرَنِي عَبْدِي بِنَفْسِهِ، حَرَّمْتُ عَلَيْهِ الْجَنَّةَ "
Narrated Jundub:
Allah's Messenger (ﷺ) said, "Amongst the nations before you there was a man who got a wound, and growing impatient (with its pain), he took a knife and cut his hand with it and the blood did not stop till he died. Allah said, 'My Slave hurried to bring death upon himself so I have forbidden him (to enter) Paradise.' "
Full reference and source
Sahih al-Bukhari 3463 In-book : Book 60, Hadith 130 USC-MSA web (English) : Vol. 4, Book 55, Hadith 669 (deprecated)
View source on Sunnah.com (opens in a new tab)