In al-Kafi volume 3 we find a strange hadith :

"Muhammad ibn Yahya has narrated from Ahmad ibn Muhammad ibn ‘Isa from ‘Uthman ibn ‘Isa from Sama‘ah ibn Mehran who has said the following: “Abu ‘Abd Allah, ‘Alayhi al-Salam, has said, ‘If one knows the kind of mistake he has made, he completes it, and Sajdah (prostration) for mistake is not necessary for him. The Messenger of Allah performed al-Dhuhr Salah (prayer) with people as two Rak‘at, then he mistakenly said Salam (the phrase of offering greeting of peace). Dhu al-Shamalayn asked him, “O Messenger of Allah, is anything revealed about Salah (prayer)?” The Messenger of Allah asked, “Why is that?” He said that it is because you performed two Rak‘at. The Messenger of Allah then asked others, “Do you also say what he says?” They replied, “Yes, he is right.” The Messenger of Allah stood up, completed Salah (prayer) with them and performed two Sajdah (prostration) with them because of mistake […]"

A quite similar hadith is found in al-Bukhari.

What is the reliability of this narration ? How can the Prophet make a mistake, above all during salah ?

1- Most scholars have dismissed this hadith as not being authentic. They do not accept it

2- Some scholars believe Allah commanded the Prophet (s) to seem as if he made a “mistake” to show people (by demonstrating to them) how to fix their mistakes in Salat. So he didn’t really forget or make a mistake. He was simply following Allah’s instructions in order to teach them people