Abu Hurairah reported,

A man came to the Messenger of Allah ﷺ while he was in the mosque and called out to him, saying, "Messenger of Allah, I have committed adultery."The Prophet turned away from him. The man repeated his statement four times. When he had testified against himself four times, the Prophet ﷺ called him over and asked, "Are you insane?"He replied, "No."The Prophet asked, "Are you married?"He answered, "Yes."So the Prophet ﷺ said, "Take him away and stone him."

Bukhari 6815

Sahih

حدثنا يحيى بن بكير حدثنا الليث عن عقيل عن ابن شهاب عن أبي سلمة وسعيد بن المسيب

عن أبي هريرة رضي الله عنه قال

أتى رجل رسول الله ﷺ وهو في المسجد فناداه فقال يا رسول الله إني زنيت فأعرض عنه حتى ردد عليه أربع مرات فلما شهد على نفسه أربع شهادات دعاه النبي ﷺ فقال أبك جنون قال لا قال فهل أحصنت قال نعم فقال النبي ﷺ اذهبوا به فارجموه

البخاري 6815صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Legal punishments
Chapter
Insane man and the insane woman are not stoned
Numbering
Darussalam 6815
Bukhari 6815