Guo Huai (died 23 February 255), courtesy name Boji, was a military general of the state of Cao Wei (or Wei) during the Three Kingdoms period of China. He started his career towards the end of the Eastern Han dynasty under the warlord Cao Cao as a subordinate of Cao Cao's generals Xiahou Yuan and Zhang He. During the Three Kingdoms period, he served in Wei, the state established by Cao Cao's son Cao Pi, and lived through the reigns of four Wei emperors (Cao Pi, Cao Rui, Cao Fang and Cao Mao). From the 220s until his death in 255, he governed and defended Wei's western borders in Yong and Liang provinces (covering parts of present-day Gansu, Shaanxi, Ningxia, Qinghai and Inner Mongolia). During this time, he resisted multiple invasions by Wei's rival state, Shu Han, and quelled some rebellions by local Qiang, Di and other non-Han Chinese tribes. Family background Guo Huai was from Yangqu County (), Taiyuan Commandery, which is located southwest of present-day Yangqu County, Shanxi. His grandfather Guo Quan () and father Guo Yun () served as the Grand Minister of Agriculture () and Administrator () of Yanmen Commandery (near present-day Xinzhou, Shanxi) respectively in the Eastern Han dynasty. Guo Huai started his career in the middle of the Jian'an era (196–220) of Emperor Xian's reign in the late Eastern Han dynasty. He was nominated as a xiaolian (civil service candidate) and was subsequently appointed as an assistant official in Pingyuan Commandery. Service under Cao Cao When Cao Pi held the position of General of the Household for All Purposes () between 211 and 220, he recruited Guo Huai to serve as an officer in the law enforcement bureau under his charge. Guo Huai was later reassigned to be a clerk in the military affairs bureau of the office of the Imperial Chancellor, the position held by Cao Pi's father Cao Cao, the warlord who controlled the Han central government and the figurehead Emperor Xian since 196. In 215, Guo Huai accompanied Cao Cao on a campaign against a rival warlord, Zhang Lu, in Hanzhong Commandery. After defeating Zhang Lu and capturing Hanzhong Commandery, Cao Cao left his general Xiahou Yuan behind to guard Hanzhong against possible attacks by another rival warlord, Liu Bei, who was in the nearby Yi Province (covering present-day Sichuan and Chongqing). Guo Huai also remained in Hanzhong and served as