Hadithcore
Sahih al-Bukhari, 4622
sahih

Narrated Ibn `Abbas:

Some people were asking Allah's Messenger (ﷺ) questions mockingly. A man would say, "Who is my father?" Another man whose she-camel had gone astray would say, "Where is my she-camel? "So Allah revealed this Verse in this connection: "O you who believe! Ask not about things which, if made plain to you, may cause you trouble." (5:101)

حَدَّثَنَا الْفَضْلُ بْنُ سَهْلٍ، حَدَّثَنَا أَبُو النَّضْرِ، حَدَّثَنَا أَبُو خَيْثَمَةَ، حَدَّثَنَا أَبُو الْجُوَيْرِيَةِ، عَنِ ابْنِ عَبَّاسٍ ـ رضى الله عنهما ـ قَالَ كَانَ قَوْمٌ يَسْأَلُونَ رَسُولَ اللَّهِ صلى الله عليه وسلم اسْتِهْزَاءً، فَيَقُولُ الرَّجُلُ مَنْ أَبِي وَيَقُولُ الرَّجُلُ تَضِلُّ نَاقَتُهُ أَيْنَ نَاقَتِي فَأَنْزَلَ اللَّهُ فِيهِمْ هَذِهِ الآيَةَ ‏{‏يَا أَيُّهَا الَّذِينَ آمَنُوا لاَ تَسْأَلُوا عَنْ أَشْيَاءَ إِنْ تُبْدَ لَكُمْ تَسُؤْكُمْ‏}‏ حَتَّى فَرَغَ مِنَ الآيَةِ كُلِّهَا‏.‏

References2 variants
In-Book Reference
Book 65, Hadith 144
USC-MSA web (English) reference
Vol. 6, Book 60, Hadith 146 (deprecated numbering scheme)