The Prophet ﷺ led them in prayer and made a mistake, so he performed two prostrations, then recited the tashahhud, then gave the salam.
حدثنا محمد بن يحيى بن فارس حدثنا محمد بن عبد الله بن المثنى حدثني أشعث عن محمد بن سيرين عن خالد يعني الحذاء عن أبي قلابة عن أبي المهلب
أن النبي ﷺ صلى بهم فسها فسجد سجدتين ثم تشهد ثم سلم
[Its chain of transmission is sahih] Tirmidhi narrated it in the Prayer chapter, in the section on what has been said about the tashahhud in the two prostrations of forgetfulness, hadith 395, from the hadith of Ibn Muthanna through this route, and he said, hasan gharib sahih. Ibn Khuzayma graded it sahih, hadith 1062, as did Ibn Hibban, hadith 536, and Hakim, according to the criteria of the two Shaykhs, 1/323, and Dhahabi agreed with him. It was criticized for a defect that does not invalidate it.