from Wu to Wei — the Wu envoys to Goguryeo in 236 were executed and their heads sent to the new Inspector of You Province, Guanqiu Jian. By 238, Goguryeo had formally allied itself with Cao Wei against Gongsun Yuan. Prelude Although Gongsun Yuan was nominally a vassal of Cao Wei, his brief flirtation with Wu and brazen derogatory comments about Wei earned him a reputation as unreliable. From Wei's point of view, although the Xianbei insurrection by Kebineng had been put down recently, Liaodong's position as a buffer zone against barbarian invasions needed to be clarified. Therefore, it was clearly unacceptable that its leader, Gongsun Yuan, was of questionable loyalty. In 237, Guanqiu Jian presented a plan to invade Liaodong to the Wei imperial court and put his plan into action. With troops of You Province as well as Wuhuan and Xianbei auxiliaries, Guanqiu Jian crossed the Liao River east into Gongsun Yuan's territory and clashed with his enemy in Liaosui (遼隧; near present-day Haicheng, Liaoning). There the Wei forces suffered a defeat, and were forced to retreat due to the floods caused by the summer monsoon season. Having inflicted a disgrace on the imperial armies, Gongsun Yuan had gone too far to turn back. In a series of contradictory actions, Gongsun Yuan memorialised the Wei court in hope of getting a pardon on one hand, while formally declaring independence on the other by assuming the title King of Yan. He also assigned an era name for his reign, Shaohan (), meaning "Succeeding Han". This was problematic for his peace efforts for two reasons: first, proclaiming era names was a practice usually reserved for emperors, showing his intention to claim the imperial position; secondly, the era name itself implied that Wei's succession of the Han dynasty was somehow illegitimate. As king, he tried to entice the Xianbei into attacking Cao Wei by conferring the rank of chanyu to one of its chiefs, but the Xianbei had not recovered from the death of Kebineng: the chieftains were too preoccupied with internal disputes to launch a large-scale attack on Wei. In 238, the Wei court summoned the Grand Commandant () Sima Yi for another campaign against Gongsun Yuan. Previously, Sima Yi had been tasked with defending Wei's western borders from Shu Han's Northern Expeditions led by the Shu chancellor Zhuge Liang, so when the latter died in 234, the government of