In a semi-direct way, the "sins" of the officers of the Egyptian court, the sar hamashkim and the sar ha’ofim, played a central role in the development of the narrative of Yosef’s life. However, the Torah is not specific as to what aroused Paroh’s anger. In order to understand this, we also need to know what their roles were.
The Targum translates their positions as high-ranking officers in the areas of drinks and baking, apparently as relates specifically to Paroh. Rashi quotes the midrash that their sins were localized. Paroh found a fly in his drink and a pebble in his baked good. How do these shortcomings interplay with the episode of Yosef? Could it be that it was just a chance overlapping of events that brought them all together – in jail? Rashi explains that it had to do with the fact that Yosef’s soiled reputation was a favorite topic of the people of the court. Hashem saw to it that others were caught at offenses, so that there would be other riveting topics to discuss other than Yosef. He adds that it was also a way to arrange for Yosef’s eventual freeing. This approach does not fit in well with Seder Olam Rabba, which says that ten years passed between the incarceration of Yosef and that of the sar hamashkim and sar ha’ofim. (Rashi usually follows the dating of Seder Olam Rabba.)
We, therefore, will suggest another approach to the background of the Egyptian noblemen. The Chizkuni explains that the sar hamashkim added water into the wine and the sar ha’ofim added ground up stones into the pastries. It is hard to believe that these officers would be foolish enough to change the quality specifically of Paroh’s food. It appears, then, that according to this approach, they were not simply negligent but were caught misappropriating the resources of the kingdom in their public obligations. The society could function only if there were complete supplies of water for irrigation and grain products to feed the people and the animals. The sar hamashkim was in charge of the water and the sar ha’ofim was responsible for the supply of grains. Each of them failed in handling their critical tasks of ensuring proper storage and use of these resources.
Along these lines, we can understand a pasuk in Yeshaya (3:1): "For Hashem will remove from Yerushalayim and from Yehuda the various leaning staffs – the staff of bread and the staff of water." This is referring to removing from office the officer of water (sar hamashkim) and the officer of bread (sar ha’ofim) (see commentary of Mahari Kra). Similarly, the story in Egypt was dealing with public affairs, not individual ones. According to this, the sins of Paroh’s officers were a prelude to the ascendance of Yosef to prominence. Yosef’s responsibility for the resources of Egypt would show that it was possible to be totally accountable to the needs of the country.
This idea turns the story of the sins of these two Egyptians into a lesson we can learn from. We must know how to act responsibly and refuse to accept public corruption. It is not enough for Israel, which should be a light unto the nations, to be somewhere in the middle of the pack of the OECD, regarding public corruption.