Twelve rulers will rule the Ummah toward the End Times. None of these ḥadīth mention twelve Imāms
I wrote (a letter) to Jabir b. Samura and sent it to him through my servant Nafi', asking him to inform me of something he had heard from the Messenger of Allah ﷺ. He wrote to me (in reply): I heard the Messenger of Allah ﷺ say on Friday evening, the day on which al-Aslami was stoned to death (for committing adultery): The Islamic religion will continue until the Hour has been established, or you have been ruled over by twelve Caliphs, all of them being from the Quraish. also heard him say: A small force of the Muslims will capture the white palace, the police of the Persian Emperor or his descendants.
I also heard him say: Before the Day of Judgment there will appear (a number of) impostors. You are to guard against them. I also heard him say: When God grants wealth to any one of you, he should first spend it on himself and his family (and then give it in charity to the poor). I heard him (also) say: I will be your forerunner at the Cistern (expecting your arrival).
أَنْ أَخْبِرْنِي بِشَىْءٍ سَمِعْتَهُ مِنْ رَسُولِ اللَّهِ ﷺ قَالَ فَكَتَبَ إِلَىَّ سَمِعْتُ رَسُولَ اللَّهِ ﷺ يَوْمَ جُمُعَةٍ عَشِيَّةَ رُجِمَ الأَسْلَمِيُّ يَقُولُ لاَ يَزَالُ الدِّينُ قَائِمًا حَتَّى تَقُومَ السَّاعَةُ أَوْ يَكُونَ عَلَيْكُمُ اثْنَا عَشَرَ خَلِيفَةً كُلُّهُمْ مِنْ قُرَيْشٍ وَسَمِعْتُهُ يَقُولُ عُصَيْبَةٌ مِنَ الْمُسْلِمِينَ يَفْتَتِحُونَ الْبَيْتَ الأَبْيَضَ بَيْتَ كِسْرَى أَوْ آلِ كِسْرَى
وَسَمِعْتُهُ يَقُولُ إِنَّ بَيْنَ يَدَىِ السَّاعَةِ كَذَّابِينَ فَاحْذَرُوهُمْ وَسَمِعْتُهُ يَقُولُ إِذَا أَعْطَى اللَّهُ أَحَدَكُمْ خَيْرًا فَلْيَبْدَأْ بِنَفْسِهِ وَأَهْلِ بَيْتِهِ وَسَمِعْتُهُ يَقُولُ أَنَا الْفَرَطُ عَلَى الْحَوْضِ