The Rules of Forgetfulness (Sahw) in Prayer
Man Lā Yaḥḍuruh al-Faqīh|Volume 1|Book 1|Chapter 50
وَ قَدْ رَوَى زُرَارَةُ عَنْ أَبِي جَعْفَرٍ عَلَيْهِ اَلسَّلاَمُ قَالَ - قُلْتُ لَهُ رَجُلٌ نَسِيَ أَوَّلَ تَكْبِيرَةِ اَلاِفْتِتَاحِ فَقَالَ «إِنْ ذَكَرَهَا قَبْلَ اَلرُّكُوعِ كَبَّرَ ثُمَّ قَرَأَ ثُمَّ رَكَعَ وَ إِنْ ذَكَرَهَا فِي اَلصَّلاَةِ كَبَّرَهَا فِي مَقَامِهِ فِي مَوْضِعِ اَلتَّكْبِيرِ قَبْلَ اَلْقِرَاءَةِ أَوْ بَعْدَ اَلْقِرَاءَةِ» قُلْتُ فَإِنْ ذَكَرَهَا بَعْدَ اَلصَّلاَةِ قَالَ «فَلْيَقْضِهَا وَ لاَ شَيْءَ عَلَيْهِ.
Zurarah narrated from Imam Muhammad ibn Ali Al-Baqir عليه السلام who said: "I asked about a man who forgot the first Takbir of the prayer (Takbir al-Ihram). Imam عليه السلام said: 'If he remembers it before the bowing (ruku'), he should say the Takbir, then recite, and then perform the ruku'. If he remembers it during the prayer, he should say the Takbir at the place of the Takbir, whether before or after the recitation.' I asked: 'What if he remembers it after the prayer?' Imam عليه السلام said: 'Then he should make it up, and there is nothing wrong with him.'"
- Ṣaḥīḥ al-Faqīh