In 617, the general Li Yuan, fearful of Emperor Yang because Emperor Yang had become displeased with him over his inability to defend against Tujue attacks and suspicious of him after there had been prophecies that the next emperor would be named Li, rebelled at his headquarters at Taiyuan (太原, in modern Taiyuan, Shanxi). Li, wanting to both distance himself from Emperor Yang while declaring to the Sui forces that he was still loyal to Sui, claimed that his goal was to support Yang You as emperor and to persuade Yang Guang to return from Jiangdu (江都, in modern Yangzhou, Jiangsu) as "Taishang Huang" (retired emperor). Li proceeded quickly to Chang'an, and during Li's campaign, Wei died. Wei's lieutenants Yin Shishi () and Gu Yi () were left in charge of the city and guardianship over Yang You.