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:2:132

And Abraham instructed his sons ˹to do the same˺ and ˹so did˺ Jacob, ˹saying˺, "O my sons, indeed Allah has chosen for you this religion, so do not die except while you are Muslims."  

And Abraham enjoined (wassā; may also be read awsā) upon his sons this, creed, and ˹so did˺ Jacob, upon his sons, saying: ‘My sons, God has chosen for you the ˹true˺ religion, the religion of submission ˹to God˺ (islām), see that you die not save in submission: he forbade them from abandoning this submission ˹to God˺, and enjoined them to adhere firmly to it until death overtook them.
القرآن:٢:١٣٢

وَوَصَّىٰ بِهَا إِبْرَاهِيمُ بَنِيهِ وَيَعْقُوبُ يَا بَنِيَّ إِنَّ اللَّهَ اصْطَفَىٰ لَكُمُ الدِّينَ فَلَا تَمُوتُنَّ إِلَّا وَأَنْتُمْ مُسْلِمُونَ  

{ووصَّى} وفي قراءة أوصى {بها} بالملة {إبراهيم بنيه ويعقوب} بنيه قال: {يا بني إن الله اصطفى لكم الدين} دين الإسلام {فلا تموتنَّ إلا وأنتم مسلمون} نهى عن ترك الإسلام وأمر بالثبات عليه إلى مصادفة الموت.