After this, the king of Egypt's cupbearer and his baker offended their master, the king of Egypt.
References for Genesis 40:1
Pharaoh was angry with his two officers, the chief cupbearer and the chief baker,
and put them in custody in the house of the captain of the guard, in the prison where Joseph was confined.
The captain of the guard assigned Joseph to them, and he became their personal attendant. And they were in custody for some time.
References for Genesis 40:4
The cupbearer and the baker of the king of Egypt, who were confined in the prison, each had a dream. Both had a dream on the same night, and each dream had its own meaning.
When Joseph came to them in the morning, he saw that they looked distraught.
So he asked Pharaoh's officers who were in custody with him in his master's house, "Why are your faces sad today?"
"We had dreams," they said to him, "but there is no one to interpret them." Then Joseph said to them, "Don't interpretations belong to God? Tell me [your dreams]."
References for Genesis 40:8
So the chief cupbearer told his dream to Joseph: "In my dream there was a vine in front of me.
On the vine were three branches. As soon as it budded, its blossoms came out and its clusters ripened into grapes.
Pharaoh's cup was in my hand, and I took the grapes, squeezed them into Pharaoh's cup, and placed the cup in Pharaoh's hand."
"This is its interpretation," Joseph said to him. "The three branches are three days.
In just three days Pharaoh will lift up your head and restore you to your position. You will put Pharaoh's cup in his hand the way you used to when you were his cupbearer.
References for Genesis 40:13
But when all goes well for you, remember that I was with you. Please show kindness to me by mentioning me to Pharaoh, and get me out of this prison.
For I was kidnapped from the land of the Hebrews, and even here I have done nothing that they should put me in the dungeon."
When the chief baker saw that the interpretation was positive, he said to Joseph, "I also had a dream. Three baskets of white bread were on my head.
In the top basket were all sorts of baked goods for Pharaoh, but the birds were eating them out of the basket on my head."
"This is its interpretation," Joseph replied. "The three baskets are three days.
In just three days Pharaoh will lift up your head-from off you-and hang you on a tree. Then the birds will eat the flesh from your body."
References for Genesis 40:19
On the third day, which was Pharaoh's birthday, he gave a feast for all his servants. He lifted up the heads of the chief cupbearer and the chief baker:
he restored the chief cupbearer to his position as cupbearer, and he placed the cup in Pharaoh's hand;
but he hanged the chief baker, just as Joseph had explained to them.
References for Genesis 40:22
Yet the chief cupbearer did not remember Joseph; he forgot him.
References for Genesis 40:23