I was asked to show sources which make the claim that gedolim are infallible or at least make infallible pronouncements. There are in fact many. Some of which I have published - such as Rav Eybshuetz's statement that the Shulchan Aruch was written with ruach hakodesh. There are two steps 1) gedolim have ruach hakodesh - from prophecy or intellect 2) knowlege obtained through ruach hakodesh is without error - is stated clearly by the Ramchal below.
Of course - this means that theoretically that gedolim can make mistakes - however it also clearly means that at least some of their statements are infallible. It is because of this claim that gedolim have ruach hakodesh - that is is considered presumption for a non-gadol to question the statements or deeds of a gadol. It is obvious that while this is a wide spread contemporay belief - it is hand has not been universal. For example the Ravad asserted that he was correct in a halachic dispute because he had ruach hakodesh. This did not stop the Ramban and others from disagreeing with him. In fact the Chasam Sofer says that the basis of all knowledge is ruach hakodesh and that is why we make a beracha on a wise non-Jewish intellectual.
Of course - this means that theoretically that gedolim can make mistakes - however it also clearly means that at least some of their statements are infallible. It is because of this claim that gedolim have ruach hakodesh - that is is considered presumption for a non-gadol to question the statements or deeds of a gadol. It is obvious that while this is a wide spread contemporay belief - it is hand has not been universal. For example the Ravad asserted that he was correct in a halachic dispute because he had ruach hakodesh. This did not stop the Ramban and others from disagreeing with him. In fact the Chasam Sofer says that the basis of all knowledge is ruach hakodesh and that is why we make a beracha on a wise non-Jewish intellectual.
Ramchal (Mamar HaIkkarim): Below the level of prophecy there is a level known as ruach hakodesh. It is a state in which Gd provides an emanation to a man’s intellect which fixes knowledge in his mind without error and with which he is absolutely certainty. As a consequence he knows this information totally with its causes and effects on every level. Through the inspiration of this ruach hakodesh it is possible to understand matters which are also known by ordinary human intelligence. However there is a distinct advantage of learning these matters through ruach hakodesh instead of natural intelligence. Learning through ruach hakodesh is effortless, without error and without doubts – something which is not characteristic of knowledge acquired by natural human intellect. Furthermore it is possible to obtain knowledge through ruach hakodesh that transcends the capabilities of normal human intellect e.g., hidden secrets as well as what will happen in the future. Another characteristic of ruach hakodesh is that the recipient is aware without any doubt that he is receiving the emanation. However, there are times when a person has a spontaneous inspiration in which he grasp fully some concept without his being aware of an emanation. This is sometimes inaccurately also called ruach hakodesh.