Hadithcore
Sahih al-Bukhari, 4621
sahih

Narrated Anas:

The Prophet (ﷺ) delivered a sermon the like of which I had never heard before. He said, "If you but knew what I know then you would have laughed little and wept much." On hearing that, the companions of the Prophet (ﷺ) covered their faces and the sound of their weeping was heard. A man said, "Who is my father?" The Prophet (ﷺ) said, "So-and-so." So this Verse was revealed: "Ask not about things which, if made plain to you, may cause you trouble." (5:101)

حَدَّثَنَا مُنْذِرُ بْنُ الْوَلِيدِ بْنِ عَبْدِ الرَّحْمَنِ الْجَارُودِيُّ، حَدَّثَنَا أَبِي، حَدَّثَنَا شُعْبَةُ، عَنْ مُوسَى بْنِ أَنَسٍ، عَنْ أَنَسٍ ـ رضى الله عنه ـ قَالَ خَطَبَ رَسُولُ اللَّهِ صلى الله عليه وسلم خُطْبَةً مَا سَمِعْتُ مِثْلَهَا قَطُّ، قَالَ ‏

‏ لَوْ تَعْلَمُونَ مَا أَعْلَمُ لَضَحِكْتُمْ قَلِيلاً وَلَبَكَيْتُمْ كَثِيرًا ‏

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

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