Rabbi Mordechai Willig
The Ramban, based on Rashi, explains that even if it is obvious to you that the Rabbis are mistaken, you must do as they command; what Hashem commanded is to perform His mitzvos as understood by the Sanhedrin, even if they err in your eyes as one who exchanges right for left. Moreover, you should think that they are correct, as Hashem protects them from mistakes. There is a great need for this mitzvah for otherwise there will be many (unresolved) disputes and many Torahs.
The Chinuch (496) adds that even if they err we should act according to their error. It is better to suffer one error and have everyone subject to their leadership always, than have everyone act according to his own opinion. This would destroy the religion, split the people and undo the nation completely. The Chinuch concludes that we must obey the gedolim in Torah wisdom and our judges in our generation. Earlier (495) he concludes that one who does not follow the advice (atzas) of the gedolim of the generation in Torah wisdom violates this mitzvah. His punishment is great, since this mitzvah is the strong pillar on which the Torah rests.
"If all of Israel will err, and a matter was hidden from the eyes of the people, and they ruled that a serious Kares violation is permitted, and the people sinned based on their ruling" (Vayikra 4:13 with Rashi). The possibility that the Sanhedrin (the eyes of the people) err is thus acknowledged by the Torah. Since the people properly followed the Sanhedrin, each "sinner" is exempt from the korban chatas required of one who commits such a sin unintentionally. Instead, when the mistake becomes known, a single offering is brought for the entire nation, with the participation of members of the Sanhedrin (4:14-15 with Rashi). This reinforces the ideas expressed by the Ramban and the Chinuch in Parshas Shoftim, regardless of whether such a serious error ever happened or not.
The Gemara (Gittin 56a) attributes the destruction of the second Bais Hamikdash to an apparent rabbinic error by R' Zecharya ben Avkulas. He should have allowed a blemished offering to be brought as pikuach nefesh demands, or ordered Bar Kamtza killed (Rashi) as a rodef. Some explain that he was exceedingly humble (anvesanuso), and felt he was not qualified to make such a difficult decision (Maharatz Chayos). Others suggest that he was by nature indecisive (as in Tosefta Shabbos 17:4).
The Chasam Sofer defends R' Zecharya by explaining that until that incident it was unthinkable that a Jew would react to a small indignity by actually slandering the Jews with a false accusation that they rebelled against the Roman authorities. In retrospect, Bar Kamtza should not have been embarrassed by another Jew, and R' Zecharya should have recognized that there was in fact real danger to life. Henceforth, one should always fear the consequences of his action or inaction (55b, Tosfos d.h. Ashrei).
The Kovetz He'aros (49:7,8) suggests a halachic error. The Rabbis wanted to offer the blemished animal for the sake of peace with the Roman kingdom, i.e. pikuach nefesh. R' Zecharya responded, "They will say a blemished animal may be offered." If so, a violation will occur when life is not in danger. This halachic argument, however, is incorrect, since causing a sin (lifnei iver) is also set aside for pikuach nefesh.
In sum, R' Zecharya's error may have been halachic, similar to one of Sanhedrin in Parshas Vayikra. Or, it may have been excessive humility, indecisiveness, or a faultless inability to imagine an unprecedented threat to life.
Later (56b), R' Yochanan ben Zakai (RYB"Z) asks the Roman general Vespasian for Yavne and its scholars, R' Gamliel's family, and a doctor to heal R' Tzadok. R' Akiva criticized RYB"Z, arguing that he should have asked Vespasian to spare Yeushalayim. RYB"Z thought Vespasian would not have agreed to such a great request, and settled for a small salvation (hatzala purta).
R' Akiva invoked the pasuk (Yeshayahu 44:25), "Hashem turns wise men backwards and their thinking foolish." In his view, RYB"Z made a colossal error in judgement, not in halacha. Usually, the advice of gedolei Torah is unerring. One who learns Torah lishma merits many things. From him is the benefit of counsel (eitza) and wisdom (Avos 6:1). Only Hashem's intervention caused RYB"Z to make an unwise decision.
But was it really unwise? Perhaps R' Akiva was wrong, and Vespasian would not have granted a request to spare Yerushalayim! This can never be proven or disproven. On his deathbed, RYB"Z did not know his fate in the afterlife (Brachos 28b). He was still unsure if his momentous decision was correct or not (Rav Soloveitchik, Chamesh Derashos, p. 35).
Errors have been attributed to great rabbanim over the generations, in halacha and in advice. Yet, as the Chinuch writes, we are duty-bound to follow gedolei Torah in every generation in both areas, as the alternative is halachic anarchy and, usually, poorer advice. Major errors are the exception, and, per R' Akiva, result from Divine Intervention. During the past century, such mistakes of great Rabbonim, in the face of unprecedented dangers, may be errors only retrospectively, as the Chasam Sofer explains.
Parshas Shoftim concludes with the egla arufa. The elders, i.e. the Sanhedrin (Rashi 21:2), say "Our hands have not spilled this blood (of the victim, 21:1) and our eyes did not see (21:7)." Would you think that the Sanhedrin are murderers? Rather, [they are declaring that ] we did not see him leaving and did not send him off without food and without escort (Rashi, from Sotah 45b).
Sforno (21:4) writes that the killer was unknown to the Sanhedrin. Had they known, they would have eliminated him. They did not spill blood (21:7) means that they did not leave any known murderer in the land.
What if they did not escort the victim, or eliminate a known murderer? R' Chaim Kanievsky (Nachal Eisan 15:2) rules that in such a situation they cannot say "Our hands etc.," and perhaps cannot perform the egla arufa ritual at all.
In a recent letter (24 Tishrei 5781) R' Asher Weiss wrote: We are ashamed that each day people, including great rabbis, pass away from COVID-19, and we cannot say "Our hands did not spill this blood." This presumably refers to rabbanim who did not take and require precautions in the face of the plague, as their illustrious predecessors, from Talmudic times through the 19th century, did with alacrity. We must be more strict than the government, not less.
Rabbinic error, then, can be responsible for the loss of life r"l. Whatever the reason, we must learn the bitter lesson and be vigilant in the face of the recent uptick in COVID-19 (through the Delta variant). Proper medical and halachic rulings, and advice, must be followed (see Rabbi Mayer Twersky, Do not be Exceedingly Righteous).
The Chinuch applies the mitzvah to obey the Sanhedrin to the rulings and advice of gedolim in Torah wisdom of every generation. While the definition of a gadol b'Torah is not precise, practices not sanctioned by any gadol may not be adopted.
In the absence of the Sanhedrin, there is no majority rule amongst gedolim. One can choose a gadol, or his disciple, as his rav (see Pillars). In communal matters, the greatest gedolim should be our guides, in strictly halacha as well as in halachic policy decisions. Recent gedolim, from the Chazon Ish (Pe'er HaDor vol. 5 p. 52,53) to Rav Soloveitchik, (Yalkut Hamoadim p. 711, Divrei Hagos V'Ha'arach, p.187) have expressed this notion (even though they differ in their reaction to those who only defer to gedolim on strictly halachic matters.)
Notwithstanding rabbinic fallibility, obeying the rulings and advice of one's rav is the better alternative, as the Chinuch teaches. May we learn these lessons and thereby merit the return of the Sanhedrin with the coming of the Mashiach.
See Contemporary Halachic Problems, vol. 3 p. 82.