Sahih Muslim , Book 1, Hadith 10 (USC-MSA)

It is narrated on the authority of Thabit that Anas said: We were forbidden in the Holy Qur'an that we should ask about anything from the Messenger of Allah and then Anas reported the hadith in similar words.

حَدَّثَنِي عَبْدُ اللَّهِ بْنُ هَاشِمٍ الْعَبْدِيُّ، حَدَّثَنَا بَهْزٌ، حَدَّثَنَا سُلَيْمَانُ بْنُ الْمُغِيرَةِ، عَنْ ثَابِتٍ، قَالَ قَالَ أَنَسٌ كُنَّا نُهِينَا فِي الْقُرْآنِ أَنْ نَسْأَلَ رَسُولَ اللَّهِ صلى الله عليه وسلم عَنْ شَىْءٍ ‏.‏ وَسَاقَ الْحَدِيثَ بِمِثْلِهِ ‏.‏

sunnah.com