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:16:28

The ones whom the angels take in death ˹while˺ wronging themselves, and ˹who˺ then offer submission, ˹saying˺, "We were not doing any evil." But, yes! Indeed, Allah is Knowing of what you used to do.  

those whom the angels take ˹in death˺ (read ˹feminine person˺ tatawaffāhum or ˹masculine˺ yatawaffāhum) while they are wronging themselves’, through disbelief. Then they will offer submission, becoming compliant and submitting themselves ˹to belief in God˺ upon death, saying: ‘We were not doing any evil’, ˹any˺ associating others with God, whereat the angels say: ‘Nay! Surely God is Knower of what you used to do’, and will requite you for it.
القرآن:١٦:٢٨

الَّذِينَ تَتَوَفَّاهُمُ الْمَلَائِكَةُ ظَالِمِي أَنْفُسِهِمْ ۖ فَأَلْقَوُا السَّلَمَ مَا كُنَّا نَعْمَلُ مِنْ سُوءٍ ۚ بَلَىٰ إِنَّ اللَّهَ عَلِيمٌ بِمَا كُنْتُمْ تَعْمَلُونَ  

{الذين تتوفاهم} بالتاء والياء {الملائكة ظالمي أنفسهم} بالكفر {فألقوا السلم} انقادوا واستسلموا عند الموت قائلين {ما كنا نعمل من سوء} شرك فتقول الملائكة {بلى إن الله عليم بما كنتم تعملون} فيجازيكم به.