The Prophet ﷺ went out to lead the prayer and pronounced the opening takbir, then he gestured to them to wait. They remained in place while he went off and performed a full bath. He returned with water still dripping from his head and led them in prayer.When he finished, he said, "I came out to you in a state of major ritual impurity. I had forgotten until I was already standing in the prayer."
حدثنا يعقوب بن حميد بن كاسب حدثنا عبد الله بن موسى التيمي عن أسامة بن زيد عن عبد الله بن يزيد مولى الأسود بن سفيان عن محمد بن عبد الرحمن بن ثوبان
خرج النبي ﷺ إلى الصلاة وكبر ثم أشار إليهم فمكثوا ثم انطلق فاغتسل وكان رأسه يقطر ماء فصلى بهم فلما انصرف قال إني خرجت إليكم جنبا وإني نسيت حتى قمت في الصلاة
No references are available.
[Hasan], though Busiri graded it daif.Abdullah bin Musa Taymi is truthful but makes many errors (Taqrib), meaning he is daif in terms of his memory. The hadith has corroborating narrations in Bukhari, no. 275, and Muslim, no. 605, and others.