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:6:54

And when those come to you who believe in Our verses, say, "Peace be upon you. Your Lord has decreed upon Himself mercy: that any of you who does wrong out of ignorance and then repents after that and corrects himself - indeed, He is Forgiving and Merciful."  

And when those who believe in Our signs come to you, say, to them: ‘Peace be upon you. Your Lord has prescribed, He has decreed, for Himself mercy, to the effect that, truly (innahu, ‘truly’, may also be read as annahu, ‘that’, as a substitution for al-rahma, ‘mercy’) whoever of you does evil in ignorance, of it when he did it, and repents thereafter, after his ˹evil˺ deed, ˹repents˺ of it, and makes amends, in his actions — truly He, God, is Forgiving, Merciful’, towards him (a variant reading ˹for innahu, ‘truly He’˺ has annahu, ‘then He’), in other words, forgiveness shall be for him.
القرآن:٦:٥٤

وَإِذَا جَاءَكَ الَّذِينَ يُؤْمِنُونَ بِآيَاتِنَا فَقُلْ سَلَامٌ عَلَيْكُمْ ۖ كَتَبَ رَبُّكُمْ عَلَىٰ نَفْسِهِ الرَّحْمَةَ ۖ أَنَّهُ مَنْ عَمِلَ مِنْكُمْ سُوءًا بِجَهَالَةٍ ثُمَّ تَابَ مِنْ بَعْدِهِ وَأَصْلَحَ فَأَنَّهُ غَفُورٌ رَحِيمٌ  

{وإذا جاءك الذين يؤمنون بآياتنا فقل} لهم {سلام عليكم كتب} قضى {ربكم على نفسه الرحمة إنهُ} أي الشأن وفي قراءة بالفتح بدل من الرحمة {من عمل منكم سوءا بجهالة} منه حيث ارتكبه {ثم تاب} رجع {من بعده} بعد عمله عنه {وأصلح} عمله {فإنه} أي الله {غفور} له {رحيم} به، وفي قراءة بالفتح أي فالمغفرة له.