أَنَّهُمْ مَعْصُومُونَ عَنِ الْكُفْرِ قَبْلَ الْوَحْيِ وَبَعْدَهُ بِالْإِجْمَاعِ
The prophets are described as protected from disbelief before and after receiving revelation.
The explicit inclusion of before appointment and after appointment matters. Prophetic reliability is not merely an acquired body of knowledge: the messenger's person and history are connected to the trustworthiness of the message.
Any narration seeming to attribute polytheism or disbelief to a prophet requires evaluation of both its reliability and meaning. A probabilistic story should not be converted uncritically into a doctrine that conflicts with established principles.