The Rules of Forgetfulness (Sahw) in Prayer
Man Lā Yaḥḍuruh al-Faqīh|Volume 1|Book 1|Chapter 50
وَ سَأَلَ اَلْحَلَبِيُّ أَبَا عَبْدِ اَللَّهِ عَلَيْهِ اَلسَّلاَمُ: عَنْ رَجُلٍ نَسِيَ أَنْ يُكَبِّرَ حَتَّى دَخَلَ فِي اَلصَّلاَةِ فَقَالَ «أَ لَيْسَ كَانَ فِي نِيَّتِهِ أَنْ يُكَبِّرَ» قَالَ نَعَمْ قَالَ «فَلْيَمْضِ فِي صَلاَتِهِ.
The Halabi asked Imam Jafar ibn Muhammad Al-Sadiq عليه السلام about a man who forgot to say the Takbir (the opening Takbir) until he had entered the prayer. Imam عليه السلام said: "Was it not in his intention to say the Takbir?" He replied: "Yes." Imam عليه السلام said: "Then let him continue with his prayer."
- Ṣaḥīḥ al-Faqīh