Imam Jafar Sadiq (a.s.) informed – The Allah’s Messenger (s.a.w.a.) said – Whoever dies while he does not know his Imam, he is considered as one who has died in the darkness of ignorance. Allah, the Almighty, has said, ‘Obey Allah, obey the Messenger of Allah and the persons among you who possess divine authority.’ (Nisa (4):59).

Imam Ali (a.s.) was there (with divine authority) and after him were Imam Hasan (a.s.), Imam Husain (a.s.), Ali b. Husain (a.s.) and after them was Muhammad b. Ali (a.s.), recipients of divine supreme covenant, successively and
thus it will continue. The earth will not be reformed without an Imam. Whoever dies while he does not know his Imam, he is considered as one who has died in the darkness of ignorance. What each one of you will need most urgently when his soul reaches here (pointing to his chest) is to know him (the Imam) so that he can say it is certain that I have been holding to a good matter (Wilayat).
Al-Kaafi v 2 p 212, v 3 p 61