Over the years we’ve discussed a few approaches (here, here, here) to explain this Chazal. One of the famous answers is that for any other person, asking the Sar haMashkim for help or making whatever efforts could be made to get out of jail, would be viewed as proper hishtadlus. It’s only for Yosef, who exemplified such a high level of bitachon, that these efforts are viewed as wrong. He should have relied on G-d alone to bring him deliverance.I want to add 2 extra cents to this answer. Ramban in last week’s parsha asks why Yosef never once tried to contact his father. Why for 22 years did he not even send one letter home to let Ya’akov know that he was alive and well? Ramban answers that Yosef realized that were he to contact his father and return home, any possibility of his dreams coming to fruition would be dashed. It was his bitachon in his dreams that led Yosef to maintain his concealment, in the hope that his brothers, and even his father, would come to Egypt and bow to him.
It’s understandable that seeing his rise in rank to majordomo in Potiphar’s home and his tremendous success there might lead Yosef to hold onto the hope that this would lead to the fulfilment of his dreams. Yet Yosef maintained his faith in those dreams even after he was thrown in prison, even when just becoming a free man again was no more than a remote possibility (Shem m’Shmuel). Even under those dire circumstances, Yosef’s faith in his dreams prevented him from sending word to his father.The Midrash’s internal contradiction reflects the contradiction inherent in Yosef’s own behavior. Chazal are hoisting Yosef by his own petard. On the one hand, when it came to alleviating his father’s pain, Yosef placed total faith in his dreams and did nothing. On the other hand, when it came to his own painful plight, he tried to use the Sar haMashkim to get out of jail and did not rely on miraculous deliverance alone. You can’t have it both ways. Precisely because Yosef demonstrated such great bitachon and trust in his own dreams, to the point of not alleviating his father's pain because of that trust, was he held to such a high standard with respect to his own behavior.