The baker and the cupbearer of the Pharaoh offended their master and were incarcerated in the prison along with Joseph who interpreted two of their dreams: he assured the cupbearer that he would find his freedom while he told the baker that he would be executed.
Pharaoh made a banquet for his ministers. He returned the head of the cupbearers to his office of cupbearer to hand the cup to Pharaoh and, instead, hanged the head of the bakers, according to the interpretation that Joseph had given.
(Genesis 39.11-12, 16-18, 20)