A man called out in the mosque, "Who can direct me to the red camel?"The Prophet ﷺ said, "May you not find it. The mosques were built only for the purpose for which they were built."
أن رجلا نشد في المسجد فقال: من دعا إلى الجمل الأحمر، فقال النبي ﷺ: لا وجدت، إنما بنيت المساجد لما بنيت له.
Muslim narrated it in the Book of Mosques (569) from the hadith of Abdul-Razzaq, and it is in his Musannaf (1721), from Thawri, from Alqama bin Marthad, from Sulayman bin Burayda, from his father, and he related it.He also narrated it from the hadith of Waki, from Abu Sinan, from Alqama bin Marthad, with the same chain, and in it, when the Prophet ﷺ finished praying, a man stood up and said what was mentioned. In another version, this took place during the Fajr prayer.His saying, "whoever calls out about the red camel," means whoever has found my stray animal, which is the red camel, and calls me to it.His saying, "mosques were only built for that which they were built for," Nawawi said in his commentary on Sahih Muslim, "its meaning is for the remembrance of Allah Almighty, prayer, learning, discussing good matters, and the like."His saying, "I found," means if you return to this act after I have forbidden you from it.