Ḥasan al-Baṣrī, may Allah have mercy on him, is a Successor. About praying behind an imam associated with bidʿah, he said:1
صَلِّ وَعَلَيْهِ بِدْعَتُهُ
(Sahih al-Bukhari, Book of Adhan, chapter on the imamate of one affected by turmoil or innovation)
Translation: Pray; the sin of his innovation rests upon him.
These are Ḥasan's own words; that is why this is an example of a maqṭūʿ report.
1. Bidʿah (بدعت): a belief or practice introduced or adopted in the name of religion after the Prophet ﷺ, the Companions and the Successors. The detailed prayer ruling is not our topic here.