But the chief cupbearer did not remember: on that day
ולא זכר שר המשקים: בו ביום:.
and he forgot him: afterwards. Because Joseph relied on him to remember him, he was compelled to be confined for two years, as it is said:“Praiseworthy is the man who made the Lord his trust and did not turn to the haughty (רְהָבִים)” (Ps. 40:5). He did not turn to the Egyptians, who are called רַהַב, haughty. [From Gen. Rabbah 89:3]
וישכחהו: לאחר מכן. מפני שתלה בו יוסף בטחונו לזכרו, הוזקק להיות אסור עוד שתי שנים, שנאמר (תהלים מ ה) אשרי הגבר אשר שם ה' מבטחו ולא פנה אל רהבים, ולא בטח על מצרים הקרוים (ישעיה ל ז) רהב:
Reb Moshe finds this incredible. Despite our faith that Hashem's will ultimately being effected, we are expected and required to make an effort to accomplish things on our own. We know that our success or failure will be because Hashem made it so, but we must make the effort. This is elementary. Reb Moshe rejects the idea that Tzadikim Gemurim, like Yosef, should make no effort at all. So Reb Moshe says two things;
1. Yosef's experience in going to Egypt and his life there involved constant miracles. From the moment he was sold by the brothers, his life should have ended five times, and the fact that he survived and flourished was obvious divine intervention. In addition, his terrible circumstances, his unjust imprisonment, also indicated clear hashgacha pratis. So while others are expected to make personal efforts, in Yosef's case, where it was clear as day that a preordained story was unfolding moment by moment, his personal efforts were inappropriate.
But, Reb Moshe says, this only explains one year of imprisonment. Even Resha'im don't suffer in Gehinnom for more than one year, so why did Yosef remain confined for two years? So he says
2. Rashi describes the Mitzrim, and specifically the Sar HaMashkim, as רהבים. Rahav means haughty. Yosef should have realized that you never should ask for a favor from a haughty person, from a baal ga'avah, because for the ba'al gaivah, nobody matters, nobody really exists, but himself. He will not lift a finger for another unless he directly benefits. So although Yosef was already punished for his misunderstanding of the Hashgacha Pratis, he was punished again for doing something that, for Yosef, was foolish. Nothing to do with religion, it was a punishment for doing something foolish. Like when you slap a child for running into the street- it's not a religion thing, it's just teaching somebody to have more seichel and to think before he jumps.
I want to emphasize this second answer. You might ask, if Yosef was punished for failing to see or trust the Yad Hashem, what difference does it make if his request was foolish? Again, the answer is that it doesn't matter that he shouldn't have made any effort in the first place. It's true, he shouldn't have made any effort at all, and he was punished for making it. But as an entirely separate matter, whatever a man does must be done with seichel, and doing something without full focus deserves a patch.
I usually post only things of my own, but I was so enamored of the seichel hayashar in this piece that I had to put it up. When Yosef talks to Pharaoh in the beginning of Mikeitz, of course his interpretation was divinely inspired. But his brilliant suggestions to Pharaoh were not, as far as I know, part of his nevu'ah. That was what he thought of on his own, and it took a lot of courage and fast thinking to make those audacious suggestions. If Pharaoh were in a bad mood, he could have thanked Yosef for his interpretation and have him killed or thrown back into the pit. He had plenty of skilled tax-masters and bureaucrats that could have done the job. It was Yosef's presentation and words that awed Pharaoh and convinced him on the spot to take this foreign slave and make him the viceroy of Egypt. That was all Yosef's doing.
Here are Reb Moshe's words; it is written in several places, but this is what he wrote in the Darash Moshe.
שם פרש"י מפני שתלה בו יוסף בטחונו לזכרו הוזקק להיות אסור שתי שנים וכו' מה
שנענש יוסף בשנתים ימים אף שיב"ח הרי הוא שיעור העונש כעדיות ספ"ב נראה דהוא על שני דברים
א על שהי"ל לידע שרק בשבילו עשה השי"ת שישימו את שר המשקים והאופים בבית הסוהר שהוא נמצא שם ושיחלמו חלומות והוא יפתור אותם וממילא לא הי"ל לבקשו אף שודאי צריך כל אדם להשתדל במה שביכלתו ואין בזה שום חסרון בבטחון וגם יעקב עשה כל העצות אף שבטח רק בהשי"ת אבל כן הוא רצון השי"ת שהאדם ישתדל והוא יעזרהו ולא שיסמוך על נסים אבל הכא הי"ל להבין שהוא רק מעשה השי"ת להצלתו
ב שהי"ל לידע שמצרים שנקראו רהב משום שהם בעלי גאוה ובעלי הגאוה שמתגאים על לא דבר ולא שום מעלה לא שייך שיעשו איזה טובה לשום אדם שזהו מחסרון בעלי הגאוה שכל אדם שפל בעיניהם ואין כדאי להם לעשות לו טובה וצריך האדם לידע זה ולכן נענש בשתי שנים
I also want to add something from the Gemara in Bava Metziah 75b. The Gemara lists three whose prayers are ignored. The third is a person who is not successful in one city and lacks the sense and courage to move to another city and start over again. He should know that galus is mechaper, or that he's too deep into a bad circumstance to help himself, and it's time to move. If he doesn't move, then it's his own fault, and when you bring your bad fate upon yourself and are unwilling to make the effort that can resolve your problem, your tefillos will be ignored.
תנו רבנן שלשה צועקין ואינן נענין ואלו הן מי שיש לו מעות ומלוה אותן שלא בעדים והקונה אדון לעצמו ומי שאשתו מושלת עליו קונה אדון לעצמו מאי היא איכא דאמרי תולה נכסיו בנכרי איכא דאמרי הכותב נכסיו לבניו בחייו איכא דאמרי דביש ליה בהא מתא ולא אזיל למתא אחריתא:
שהרי הם גרמו לעצמן
I spoke about this idea elsewhere- that we were placed in this world not only to do Torah and Mitzvos but also to become the best human beings we are capable of becoming- and that involves every thing that expresses our humanity and seichel that we are capable of doing. You are put here not just to become a malach, but also to become a mentsch. I don't want to hide behind ambiguity here, so I'll make it clear. The Ribono shel Olam requires not only that we follow halacha and develop good middos, but also that we develop our intellectual abilities to their greatest extent. A person that is meticulous about religious law and middos but acts without seichel or lazily in worldly matters transgresses Hashem's will. It is a sin to be a na'ar. Being a na'ar is not just what Rashi says in 37:2 about Yosef being excessively interested in his appearance-
"והוא נער" - שהיה עושה מעשה נערות מתקן בשערו ממשמש בעיניו כדי שיהיה נראה יפה-it involves anything done without intelligence and maturity.