Yosef's Bitachon, and His Asking the Sar Hamashkim for Help
It states (Tehillim 40:5) מבטחו 'ה שם אשר הגבר אשרי כזב ושטי רהבים אל פנה ולא "Praiseworthy is the man who makes Hashem his trust and he did not turn to the haughty..."
The Midrash (beginning of Mikeitz) explains: מבטחו 'ה שם אשר הגבר אשרי, "Praiseworthy is the man who makes Hashem his trust." This refers to Yosef because Yosef trusted in Hashem. כזב ושטי רהבים אל פנה ולא, "and he did not turn to the haughty..." This refers to when Yosef went to the sar hamashkim and asked him to help him.
It seems from this Midrash that Yosef was wrong for making hishtadlus. (Once again, we repeat the obvious: we aren't judging Yosef HaTzaddik, whose levels of bitachon are far above our comprehension. We are merely learning lessons in bitachon from the parashah that relate to us.)
Rabbeinu b'Chayei writes that Yosef was correct for making hishtadlus and for asking the sar hamashkim to help him, but the problem was that he said twice הזכרתני ,זכרתני, requesting that the sar hamashkim remember him. He repeated this request twice, which was too much hishtadlus, and showed that he trusted in the sar hamashkim.
Reb Shlomo Kluger (Imrei Shefer, Chanukah) also discusses this Midrash. He writes, "The Yefeh Toar asks correctly, is it forbidden for a person to make hishtadlus? ... Must he rely on a miracle? Why is Yosef taken to task for doing hishtadlus? On the contrary, Chazal say, 'Perhaps a person can be idle and do nothing, but behold it states וברכתיך תעשה אשר בכל, that Hashem blesses us when we do!"
Reb Shlomo Kluger answers, "I think that a person should certainly make hishtadlus according to the rules of nature, and he shouldn't rely on miracles. He should do hishtadlus according to the path of nature. But when a person doesn't need the salvation right away, only later on, he shouldn’t make hishtadlus now. If he has strong bitachon in Hakadosh Baruch Hu and he believes that Hashem has the ability to turn nature around and to create something from nothingness, he shouldn't engage in natural means of hishtadlus for something that he needs in the future, and it isn't so pressing at the moment. When the time arrives that he needs the salvation, and Hakadosh Baruch Hu didn't yet bring the miracle, that is when he can make hishtadlus according to the rules of nature. We find in Chazal (Sotah 48:), 'If a person has parnassah for today and he wants to make parnassah for tomorrow, he is אמונה מקטני, from the people who have a low level of emunah.' Why should he worry about tomorrow? Until tomorrow, Hashem can help. Also, it states (Beitzah 16.) "Hillel had a different approach: He would say יום 'ה ברוך יום. This means he had a high level of bitachon in Hakadosh Baruch Hu and didn't do hishtadlus from one day to the next. Someone who doesn't have such a high level of bitachon makes hishtadlus... to earn a lot of money, so he will have money in advance for his family that will last for a long time. He is afraid to wait until later because, maybe later, he won't find a way to earn parnassah according to the rules of nature, and he doesn't have bitachon in Hashem.
"This was Yosef's error: When he explained the dream to the sar hamashkim, it was three days before the sar hamashkim was taken out of prison. If Yosef had fully trusted in Hashem, he wouldn't have made hishtadlus the moment after he explained the dream to the sar hamashkim. He would have waited until the third day when the sar hamashkim would leave jail, and on that day, he could make hishtadlus and ask the sar hamashkim to speak on his behalf to Pharaoh. Although, at that time, perhaps his words wouldn't have had such an effect and impact on the sar hamashkim as now when he interpreted the dream, nevertheless, Hakadosh Baruch Hu has other ways to save him. Why should he ask two days early? Therefore, since Yosef asked two days early, he was punished with two years in jail. A year for each day, as the miraglim were punished for forty years because of the forty days they spied Eretz Yisrael - a year for a day."
There is a third way to understand this Midrash, and we begin with a story with Reb Aharon of Titayov zt'l, a grandson of the Baal Shem Tov zt'l. (His father was Reb Hersh, a son of the Baal Shem Tov). At one point in his life, he was a concealed tzaddik. People didn't pay attention to him or to his needs because they didn't realize his great levels. His family suffered from poverty. Once, Reb Aharon couldn't take the distress of his family anymore, and after maariv, he announced in the beis medresh that he is a grandson of the Baal Shem Tov, and why isn't anyone helping him?
His announcement inspired them, and they immediately began planning to help him. After everyone went home, Reb Aharon thought about what he had done and regretted that he trusted in human beings and left his usual way of trusting solely in Hashem. He davened all night long amidst bitter tears that Hashem should cause everyone to forget everything that occurred that night.
This story was repeated by Reb Dovid Moshe of Tchortkov zt'l and he added that with this story, we can understand the pasuk (Bereishis 40:23) וישכחהו יוסף את המשקים שר זכר ולא, "The sar hamashkim did not remember Yosef, and he forgot him." He explains that the pasuk is saying זכר ולא the sar hamashkim didn't remember Yosef, and that is because Yosef davened וישכחהו, that he should forget him. After Yosef made hishtadlus and asked the sar hamashkim to help him, he immediately regretted what he did and davened that the sar hamashkim should forget his request. Reb Dovid Moshe added, "This is the highest form of bitachon!"
He said that this is also the intention of the Midrash on the pasuk (Tehillim 40:5) אשרי מבטחו 'ה שם אשר הגבר, "Praiseworthy is the man who made Hashem his trust," רהבים אל פנה ולא כזב ושטי, "and did not turn to the haughty..." The beginning of the pasuk praises someone who has bitachon, and the end of the pasuk expresses the negative side of someone who trusts in people. But the midrash says that both parts of the pasuk refer to Yosef! The Midrash is difficult to understand because it first praises Yosef for trusting in Hashem, then states that Yosef erred because he shouldn’t have trusted in the sar hamashkim.
Reb Dovid Moshe of Tchortkov zt'l explains that the entire pasuk praises Yosef. Yosef only trusted in the sar hamashkim for a moment. Immediately after Yosef requested the sar hamashkim to help him, he regretted what he did, and he prayed to Hashem that the sar hamashkim should forget that he promised to speak to Pharaoh on his behalf. Therefore, the pasuk is praising Yosef and saying מבטחו 'ה שם אשר הגבר אשרי, "Praiseworthy is the man who made Hashem his trust, " כזב ושטי רהבים אל פנה ולא , "and did not turn to the haughty..." The second half of the pasuk also refers to Yosef because, in the end, Yosef didn't place his trust in the haughty sar hamashkim. In fact, he prayed that the sar hamashkim should forget his promise. Yosef placed his trust solely in Hashem.