محمد بن مسعود العياشي عن جعفر بن أحمد عن علي بن الحسن عن محمد بن عيسى عن يونس عن معاوية قال سألت أبا عبد الله عليه السلام عن رجل قام في الصلاة المكتوبة فسها فظن انها نافلة أو كان في النافلة فظن انها مكتوبة قال هي ما أفتتح الصلاة عليه
Muhammad ibn Mas‘ud al-‘Ayyashi from Ja‘far ibn Ahmad from Ali ibn al-Hasan from Muhammad ibn Isa from Yunus from Mu‘awiyah, who said:
I asked Abu Abdillah عليه السلام, peace be upon him, about a man who stood for an obligatory prayer but due to forgetfulness thought it was a supererogatory one, or was in a supererogatory prayer and thought it was an obligatory one. Imam عليه السلام said: "It is according to what he began the prayer upon."
Ali Akbar al-Ghaffari
Tahdhīb al-Aḥkām fī Sharḥ al-Muqniʿah, vol. 2, p. 368