At Cao Cao's instruction, Liu Bei prepared to lead a punitive expedition against Yuan Shu. Before departing, he worried about the defense of Xuzhou City. When Zhang Fei volunteered to take charge, Liu Bei expressed his concerns: "How can I feel assured? You are fond of drinking, and after drinking, you often flog your soldiers without reason. Moreover, you are hot-tempered and frequently refuse to take advice." Only after Zhang Fei's repeated entreaties and promises to mend his ways did Liu Bei entrust him with the task. For safety, he left his advisor, Chen Deng, to assist Zhang.
One day, Zhang Fei invited his subordinate officers to a gathering. "My elder brother instructed me to stay away from wine to ensure I properly guard the city," he said. "Let's have one final drinking party today. Starting tomorrow, we will quit drinking and focus on our duties." With that, he began toasting everyone.
When Cao Bao refused his toasts, Zhang Fei, already drunk, flared up in anger. He ordered Cao Bao to be flogged fifty times. After the party, the resentful Cao Bao sent a messenger to the enemy general, Lü Bu, urging him to attack the city that night while Zhang Fei was intoxicated.
Lü Bu arrived with five hundred horsemen and successfully captured the city. Zhang Fei awoke with a start to find the city lost. He fought his way through enemy troops and fled, leaving Liu Bei's family behind. When he later met Liu Bei, he was so ashamed that he unsheathed his sword, intending to commit suicide, but was stopped by his elder brother.