Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:4:18

But repentance is not ˹accepted˺ of those who ˹continue to˺ do evil deeds up until, when death comes to one of them, he says, "Indeed, I have repented now," or of those who die while they are disbelievers. For them We have prepared a painful punishment.  

Repentance is not for those who do evil deeds, sins, until, when death approaches one of them, and the pangs of death begin, he says, upon witnessing his predicament: ‘Indeed now I repent’, for this would not avail him and would not be accepted from him; neither for those who die disbelieving, if they repent in the Hereafter upon seeing the chastisement: it will not be accepted from them. Those — We have prepared for them a painful chastisement.
القرآن:٤:١٨

وَلَيْسَتِ التَّوْبَةُ لِلَّذِينَ يَعْمَلُونَ السَّيِّئَاتِ حَتَّىٰ إِذَا حَضَرَ أَحَدَهُمُ الْمَوْتُ قَالَ إِنِّي تُبْتُ الْآنَ وَلَا الَّذِينَ يَمُوتُونَ وَهُمْ كُفَّارٌ ۚ أُولَٰئِكَ أَعْتَدْنَا لَهُمْ عَذَابًا أَلِيمًا  

{وليست التوبة للذين يعملون السيئات} الذنوب {حتى إذا حضر أحدهم الموتُ} وأخذ في النزع {قال} عند مشاهدة ما هو فيه {إنِّي تبت الآن} فلا ينفعه ذلك ولا يقبل منه {ولا الذين يموتون وهم كفار} إذا تابوا في الآخرة عند معاينة العذاب لا تقبل منهم {أولئك أعتدنا} أعددنا {لهم عذابا أليما} مؤلما.