Major problem here. Jesus never promised the church would be protected from teaching error. Paul in Acts 20:29-30 warned that false teachers would come into the church and will draw disciples away. 2 Peter 2:1 also warns that false teachers will come in and decieve. In Revelation 2:20 the church at Thyatira embraced false teachings. If Jesus had promised such a thing these warnings and examples would be absurd.
Matthew 16:18-19
And I tell you, you are Peter, and on this rock I will build my church, and the powers of death shall not prevail against it.
I will give you the keys of the kingdom of heaven, and whatever you bind on earth shall be bound in heaven, and whatever you loose on earth shall be loosed in heaven."
This is Jesus establishing His Church and giving Peter (the first Bishop of Rome) the keys of the kingdom of heaven - whatever the Church binds on earth shall be bound in heaven and whatever it looses on earth shall be loosed in heaven. Also, the powers of death shall not prevail against it. In other words, the Church’s charism of infallibility is not from man, it is from Jesus himself. He promised that the powers of death would not prevail against it.
John 16:12-15
"I have yet many things to say to you, but you cannot bear them now.
[13] When the Spirit of truth comes, he will guide you into all the truth; for he will not speak on his own authority, but whatever he hears he will speak, and he will declare to you the things that are to come.
[14] He will glorify me, for he will take what is mine and declare it to you.
[15] All that the Father has is mine; therefore I said that he will take what is mine and declare it to you.
John 14:25-26
[25] "These things I have spoken to you, while I am still with you.
[26] But the Counselor, the Holy Spirit, whom the Father will send in my name, he will teach you all things, and bring to your remembrance all that I have said to you.
Here Jesus promises to send the Holy Spirit to guide his Church into all truth, teach it all things, and bring to remembrance all that I have said to you. Again, he is guaranteeing that the Church will teach the truth in faith and morals, and be led into all truth - even the things he has not yet said to them - through the ongoing development of Sacred Tradition and the Magisterium of the Church. Through these things,
all that Jesus has said will be brought to remembrance.
Holy Scripture is part of that promise. At the time Jesus was saying these things, there was no Bible. It was only through the Catholic Church, guided by the Holy Spirit just as Jesus promised it would be, that the Bible came into being. Along with the Bible, the Holy Spirit guided the Church in developing Sacred Tradition as well. The Bible can only be properly understood when read in the context of, and under the guidance of, the Church and her Sacred Traditions.
Of course Peter (the first Bishop of Rome) and Paul were correct about false teachers coming in to the Church and drawing disciples away. Many of the Church councils have been in response to one heresy or another - the Arians, the Albegensians, Luther, etc.
Peter 2:1
But false prophets also arose among the people, just as there will be false teachers among you, who will secretly bring in destructive heresies, even denying the Master who bought them, bringing upon themselves swift destruction.
Sola scriptura is one of these destructive heresies - it denies the Church founded by Jesus Christ, it denies the promises Jesus made that the gates of Hades will not prevail against that Church, it denies that Jesus sent the Holy Spirit to lead the Church into all truth and bring all he said to remembrance - in other words, sola scriptura denies the Master who brought them, just as Peter predicted.
Sola scripturists are following a false doctrine, a heresy, and need to take heed of what Peter says they are doing - “bringing upon themselves swift destruction.”