Yuwen Huaji
In spring 618, with the Sui state engulfed in various rebellions, Yang Hao was with Emperor Yang at Jiangdu (江都, in modern Yangzhou, Jiangsu), when a coup led by the general Yuwen Huaji (Yuwen Shu's son) killed Emperor Yang. The coup leaders also killed many of Emperor Yang's relatives and high-level officials. However, as Yang Hao was friendly with Yuwen Huaji's brother Yuwen Zhiji (), Yuwen Zhiji persuaded Yuwen Huaji to spare Yang Hao, and subsequently, Yang Hao was declared emperor by an edict issued in the name of Emperor Yang's wife Empress Xiao, although Yuwen Huaji wielded actual powers, as regent.