Meiri, in a comment on the argument in the Gemara Shabbat 55a, whether there is death or punishment without sin, Meiri sides with Rav Ami who says that punishment comes only with sin. He says that it is a principle, an Ikar in Jewish theology. Although the Gemara refutes Rav Ami, quoting a Braitha saying that four people died although they never sinned which seems to indicate that there is death without sin, Meiri disputes the conclusion of the Gemara saying:
אין עיקרי האמונות תלויות בראיות של פשוטי מקראות ואגדות וכבר ידעת שאין משיבין באגדה
The principles of Faith (Ikarim) do not depend on the testimony of the literal sense of scriptures or Aggadot. And it is well known that one does not base refutations on Aggadot.
In other words just because a Gemara concluded that one opinion stands based on an irrefutable earlier source, where had it been a Halachik question we would have to abide by the Gemara’s decision, in Aggadot we do not. We follow the rational reasoning and assume the Braitha that is quoted as a source for the refutation of one opinion and the basis for the Gemara’s decision, should not be read literally.
Professor David Halivni quotes this Meiri in his essay “Prayer in the Shoah” in the recently published collection of his thoughts on the Holocaust, Breaking the Tablets.