Yiftach 10-11
ואומר (תהלים צט, ו) משה ואהרן בכהניו ושמואל בקוראי שמו שקל הכתוב שלשה קלי עולם כשלשה חמורי עולם לומר לך ירובעל בדורו כמשה בדורו בדן בדורו כאהרן בדורו יפתח בדורו כשמואל בדורו ללמדך שאפילו קל שבקלין ונתמנה פרנס על הצבור הרי הוא כאביר שבאבירים ואומר (דברים יז, ט) ובאת אל הכהנים הלוים ואל השופט אשר יהיה בימים ההם וכי תעלה על דעתך שאדם הולך אצל הדיין שלא היה בימיו הא אין לך לילך אלא אצל שופט שבימיו ואומר (קהלת ז, י) אל תאמר מה היה שהימים הראשונים היו טובים מאלה:
And it says in another verse: “Moses and Aaron among His priests, and Samuel among those who call His name; they called upon the Lord, and He answered them” (Psalms 99:6). This verse equates Samuel to Moses and Aaron. In this manner, the verse weighed three light ones of the world, i.e., it considered the three less distinguished figures of Gideon, Samson, and Jephthah as equal to three significant ones of the world, Moses, Aaron, and Samuel, three of the greatest leaders of the Jewish people. This comes to tell you that Jerubaal in his generation is worthy of being treated like Moses in his generation; Bedan in his generation is like Aaron in his generation; and Jephthah in his generation is like Samuel in his generation. This serves to teach you that even the lightest of the light, i.e., the least distinguished individual, once he has been appointed as a leader over the community, he must be treated like the greatest of the great, and all are required to heed him and obey his rulings. And it further says: “And you shall come to the priests, the Levites, and to the judge who shall be in those days” (Deuteronomy 17:9). But can it enter your mind that a person can go to a judge that is not alive in his days? What, then, is the meaning of the phrase “in those days”? It teaches that you need to go only to the judge in one’s days, i.e., he is authorized to judge and decide matters. And it also says: “Do not say: How was it that the former days were better than these? For it is not out of wisdom that you inquire concerning this” (Ecclesiastes 7:10). Instead, one must accept the rulings of the leaders of his generation.
א"ר שמואל בר נחמני אמר רבי יונתן שלשה שאלו שלא כהוגן לשנים השיבוהו כהוגן לאחד השיבוהו שלא כהוגן ואלו הן אליעזר עבד אברהם ושאול בן קיש ויפתח הגלעדי אליעזר עבד אברהם דכתיב (בראשית כד, יד) והיה הנערה אשר אומר אליה הטי נא כדך וגו' יכול אפי' חיגרת אפי' סומא השיבו כהוגן ונזדמנה לו רבקה שאול בן קיש דכתיב (שמואל א יז, כה) והיה האיש אשר יכנו יעשרנו המלך עושר גדול ואת בתו יתן לו יכול אפי' עבד אפילו ממזר השיבו כהוגן ונזדמן לו דוד יפתח הגלעדי דכתיב (שופטים יא, לא) והיה היוצא אשר יצא מדלתי ביתי וגו' יכול אפילו דבר טמא השיבו שלא כהוגן נזדמנה לו בתו
As a preamble to the statement of Rabbi Berekhya, below, the Gemara cites that which Rabbi Shmuel bar Naḥmani said that Rabbi Yonatan said: Three people entreated God in an unreasonable manner, i.e., in situations where their requests might have received an unfavorable answer. To two of them God responded reasonably, with a favorable response to their requests, and to one God responded unreasonably, i.e., unfavorably, in a manner befitting the unreasonable request. And they are: Eliezer, servant of Abraham; Saul, son of Kish; and Jephthah the Gileadite. The Gemara clarifies each of these cases in turn: With regard to Eliezer, servant of Abraham, he made a request when he prayed beside the well, as it is written: “That the maiden to whom I shall say: Please let down your pitcher that I may drink; and she shall say: Drink, and I will also give your camels to drink; that she be the one whom you have appointed for your servant Isaac” (Genesis 24:14). Eliezer entreated God unreasonably, as his request allowed for the possibility that she might even be lame or even blind, and yet he had promised to take her to Isaac. Nevertheless, God responded to him reasonably and the eminently suitable Rebecca happened to come to him. With regard to Saul, son of Kish, he made an offer when Goliath the Philistine challenged the Jews, as it is written: “And it shall be that the man who kills him, the king will enrich him with great riches, and will give him his daughter” (I Samuel 17:25). The man who killed Goliath might even have been a slave or a mamzer, one born from an incestuous or adulterous union, who would be unfit to marry his daughter. Nevertheless, God responded to him reasonably and David happened to come to him. By contrast, there is the case of Jephthah the Gileadite. Upon leaving for battle he issued a statement, as it is written: “Then it shall be that whatever comes forth from the doors of my house to meet me when I return in peace…it shall be to the Lord and I will bring it up for a burnt-offering” (Judges 11:31). This might even have been an impure, non-kosher animal, which he had committed himself to sacrifice. In this instance, God responded to him unreasonably, and his daughter happened to come to him.

Midrash Tanchuma

'

When Yiftach came to offer his daughter, she cried before him: "Father I went out to greet you with joy, and you want to slaughter me? Did Hashem ever write in his torah that people can bring human beings as offerings? IT says unambiguously that 'any person who brings an offering to Hashem from the animals '- from animals and not people". Yiftach answered that he made such a vow, and it is not possible to vow and not fulfill it.

Midrash Tanchuma

A person who is righteous but not learned has accomplished nothing...Because Yiftach was not a Torah SCholar, he lost his daughter....At the moment he made his vow, Hashem became angry at him and said: " If a dog or a camel had emerged first from his house, would he have offered that to me? So Hashem arranged that his daughter should come out first, So People who make vows should learn the laws of vows and not make mistakes in their vows.