I heard the Messenger of Allah ﷺ say, "Whoever hears a man announcing a lost item in the mosque should say to him, 'May Allah not return it to you,' for the mosques were not built for this purpose."
حدثنا هارون بن معروف قال أخبرني ابن وهب أخبرني حيوة عن محمد بن عبد الرحمن عن أبي عبد الله مولى شداد بن الهاد أنه
سمعت رسول الله ﷺ يقول من سمع رجلا ينشد في المسجد ضالة فليقل لا أداها الله عليك فإن المساجد لم تبن لذلك
Its chain of transmission is sahih. Muslim narrated it in 1/397, no. 568, in the book of masjids, chapter on the prohibition of announcing lost property in the masjid. Abu Dawud narrated it in 1/128, no. 473, in the book of prayer, chapter on the dislike of announcing lost property in the masjid. And Ibn Majah narrated it in 1/252, no. 767, in the book of masjids, chapter on the prohibition of announcing lost property in the masjid.