The Prophet ﷺ said, "Do not swear by your fathers, nor by the idols."Yazid said, "and the idols (using the variant wording at-tawaghi)."
حدثنا يزيد بن هارون أخبرنا هشام عن الحسن
عن النبي ﷺ قال لا تحلفوا بآبائكم ولا بالطواغيت وقال يزيد والطواغي
Its isnad is sahih. It is found in Muslim 3/1268, no. 1648, in the chapter on oaths, on whoever swears by Lat. Also Abu Dawud 3/219, no. 3248, and Nasai 7/5, both similarly, and Ibn Majah 1/678, no. 2095, in the chapter on expiations, and Ibn Hibban 10/199, no. 4357, Al-Ihsan.