Yeah i have been thinking about that. If its tradition that popes are not in error. Then why was Peter confused on the circumcission stuff?. I know the answer, although i am not sure if catholics would agree but its simple. He was not pope yet. So when he got that role then he was given the grace. Remember, Peter also denied Jesus to save himself and yet Jesus trusted Peter to carry out his role, he was loyal but he struggled indeed. You can think of it this way, i bet a person who is not a pope yet have done lots of bad things, but when he becomes pope god more or less blessed that person from the mistakes in earlier life. Thats just human in general, it is when someone selects a pope that he becomes free from error or mistakes more or less in a theological sense.
Well thats the answer i could come up with. Feel free to agree or disagree.
I also found a video explaining it more. I would love to hear your opinion on it?