Cheng Yuanzhen was a eunuch official of the Chinese dynasty Tang Dynasty. He was exceedingly powerful early in the reign of Emperor Daizong and was said to, in his attempts to consolidate his power, have killed or demoted a number of key generals and officials on his own whim, and thus drew the hatred from the other officials and generals. In 763, he was blamed for not warning Emperor Daizong about the Tubo invasion that eventually caused the capital Chang'an to fall to Tubo forces, forcing Emperor Daizong to flee. Emperor Daizong exiled him, and he died in exile.
Background
Cheng Yuanzhen was from Jingzhao Municipality -- the special municipality centered on the Tang capital Chang'an. He was a eunuch from his youth and served at the eunuch bureau, eventually rising to be the commander of the imperial guard archer corps as well as the deputy director of the imperial stables, under the powerful eunuch Li Fuguo, late in the reign of Emperor Suzong.
Rise to power
In summer 762, Emperor Suzong was seriously ill, near death. By this point, Emperor Suzong's wife Empress Zhang, who was previously allied with Li Fuguo, was no longer allied with him, and she tried to enter into an alliance with Emperor Suzong's son the crown prince Li Yu, to kill Li Fuguo and Cheng Yuanzhen and seize power. Li Yu declined, and she then entered into an alliance with Li Yu's younger brother Li Xi the Prince of Yue, trying to lay a trap for Li Fuguo. When she issued an edict in Emperor Suzong's name summoning Li Yu, Cheng found out about her plan and detained Li Yu, escorting him to the imperial guard headquarters. He and Li Fuguo then led troops into the palace and arrested Empress Zhang and Li Xi. Upon Emperor Suzong's death, Li Fuguo executed Empress Zhang, Li Xi, and Li Xian the Prince of Yan, and then declared Li Yu emperor. For two months early in Emperor Daizong's reign, Li Fuguo was exceedingly powerful, so much so that he was telling Emperor Daizong not to bother with any thing and just let him handle the matters of state, and Emperor Daizong gave him chancellor title, as well as several other honorific titles. Cheng was made a commanding general of the imperial guards, but was not satisfied, as he wanted to take over Li Fuguo's power, and therefore he secretly plotted with Emperor Daizong. With cooperation from Cheng, later in summer 762, Emperor Daizong, while creating Li Fuguo a prince, stripped Li Fuguo of his military command and transferred it to Cheng. Li Fuguo was subsequently assassinated on Emperor Daizong's orders, and Emperor Daizong and Cheng governed together. It was said that Cheng was suspicious and jealous of the senior generals and officials and did what he could to strip them of power. For example, he was jealous of Guo Ziyi and often criticized him before Emperor Daizong, leading Guo, who was fearful of the situation, to resign his command and remain at Chang'an. When the senior official Pei Mian had disagreements with Cheng, Cheng had Pei demoted to the remote Shi Prefecture. Meanwhile, he sometimes made requests of the general Lai Tian -- the military governor of Shannan East Circuit, which Lai rejected, and thus he was resentful of Lai. In 763, while Lai was at Chang'an, he and his associate Wang Zhongsheng, who was also resentful of Lai, jointly falsely accused Lai of treason. Lai was exiled and, on the way to exile, was ordered to commit suicide. Cheng also disliked the major general Li Guangbi and often submitted reports against Li Guangbi. The general Li Huairang, the military governor of Tonghua Circuit, was also falsely accused by Cheng and committed suicide in fear in 763. It was said that given these incidents, all of the generals felt insecure and alienated from the imperial government. Despite this, Cheng was still arrogant and believed that he could grab more power.
Downfall
Throughout the spring and summer of 763, Tibetan, or Tubo, forces were progressively attacking and capturing Tang prefectures to the west of Chang'an. It was said that despite the generals' urgent requests for aid, Cheng Yuanzhen did not relay the requests to Emperor Daizong. By winter 763, Tibetan forces were approaching Chang'an; only then did Emperor Daizong realize the seriousness of the Tibetan threat and commission Guo Ziyi to resist the Tibetan Empire. When Emperor Daizong issued an edict to the various circuits ordering emergency aid, however, the generals refused to respond, and Guo could not quickly gather troops large enough to resist Tibetan forces. Emperor Daizong was forced to abandon Chang'an and flee to Shan Prefecture. The imperial officials who followed Emperor Daizong to Shan Prefecture blamed the disaster on Cheng—in both his failure to alert Emperor Daizong as to the seriousness of the Tibetan threat and his alienation of the generals, causing a lack of aid to arrive. The imperial scholar Liu Kang submitted a harshly worded petition, asking that Cheng be executed. Emperor Daizong, however, remembering how Cheng had protected him in the past, declined to do so. He did, however, remove Cheng from his offices and order that he return home. When Emperor Daizong returned to Chang'an around the new year 764, Cheng heard the news. Putting on women's clothing in disguise, he secretly entered Chang'an and plotted to return to power. He was arrested by the Jingzhao Municipality government, and the imperial censors subsequently submitted an indictment against him. In spring 764, Emperor Daizong exiled him to Zhen Prefecture, but soon changed the location of exile to the more prosperous city ofJiangling. Cheng died there, in exile, shortly after arriving there.