Some time later, both the wine steward and the baker for Egypt's king offended their master, the king of Egypt.
References for Genesis 40:1
Pharaoh was angry with his two officers, the chief wine steward and the chief baker,
and he put them under arrest with the commander of the royal guard in the same jail where Joseph was imprisoned.
The commander of the royal guard assigned Joseph to assist them. After they had been under arrest for some time,
both of them—the wine steward and the baker for Egypt's king who were imprisoned in the jail—had dreams one night, and each man's dream had its own meaning.
When Joseph met them in the morning, he saw that they were upset.