At the end of parshat Vayeshev, Yosef begs Pharaoh's wine minister to help him get out of jail. Because of this lack of faith, say our Sages, Yosef was punished to stay in jail two extra years.
Did Yosef actually fail in his faith in God? It seems to me he was just trying to do anything that he could do at that moment. "Pirkei Avot" says: "If I am not for myself, who will be for me; And if not now, when?" Our faith in God is total and forever, but, where does faith end and our efforts begin? Where is the border between total faith and our efforts?
Great question which many commentaries speak about. I will give you one approach. God judges each person on that person's level. For a person with a lot of faith, God expects him to display a lot of faith, and he needs to take less action. For someone with less faith, he needs to take more action. If someone with less faith had done what Yosef did, it may have been considered that he didn't do enough. But for Yosef, who had a lot of faith, it was too much.
Some commentaries say the it was the fact that Yosef asked twice "ki im zechartani" - "if only you will mention me." For Yosef, once would have been enough.