The Prophet ﷺ said, "The greatest offender among the Muslims is one who asks about something that was not forbidden, and it then becomes forbidden because of his question."
أن النبي ﷺ قال: إن أعظم المسلمين جرما، من سأل عن شيء لم يحرم، فحرم من أجل مسألته.
Bukhari reported it in the Book of Holding Fast (7289), and Muslim in the Book of Virtues (2358:132), both through the route of Ibn Shihab, from Amir bin Saad bin Abu Waqqas, from his father, who related it.