It is said that since the death of Chancellor Zhuge Liang, Liu Shan, the later ruler of Shu Han, grew increasingly neglectful of government affairs. The eunuch Huang Hao, originally an attendant, gradually gained favor and power with the emperor through flattery and clever words, becoming increasingly influential. All major and minor state affairs had to pass through Huang Hao's hands; bribery was rampant and discipline collapsed. General Jiang Wei, upholding the late Marquis's legacy, campaigned annually against Cao Wei; despite some victories and defeats, Shu Han's strength waned, and Huang Hao's monopoly of power in the court caused many obstructions. Deeply troubled, Jiang Wei repeatedly submitted memorials, accusing Huang Hao of treachery and calling for his execution.
But Liu Shan merely said: 'Huang Hao is just a minor eunuch; I know his character well. Why worry about him?'
Jiang Wei’s earnest remonstrance went unheeded; instead, Huang Hao became even more arrogant. Huang Hao's faction spread throughout the court; anyone who wanted to advise Liu Shan had to first gauge Huang Hao's opinion. If they disagreed with him, he would create obstacles and obstruct them by every means. Loyal ministers such as Zhuge Zhan and Dong Jue were all objects of his suspicion. Jiang Wei once strongly urged Liu Shan, saying that Huang Hao's long stay in the palace could cause great trouble, and proposed to send him away. When Huang Hao learned of this, he tearfully told Liu Shan: 'I have received great favor from Your Majesty; how dare I have any other intentions? It is the Grand General who wants to frame me as disloyal!'
Liu Shan believed his words and instead blamed Jiang Wei for being meddlesome.
From then on, Huang Hao became even more favored, wielding power over the entire court. Loyal officials and righteous men in the court, seeing his power, dared to be angry but not to speak out. Seeing Shu Han increasingly deteriorate, with deep internal troubles, Jiang Wei was burning with anxiety. At that time, the great generals of Cao Wei, Deng Ai and Zhong Hui, each garrisoned the borders, waiting for an opportunity to act. Jiang Wei deeply understood that with a powerful enemy outside and treacherous ministers causing chaos inside, if Huang Hao was not removed, the state would not survive. However, Liu Shan was weak-willed, prone to believe slander, and Jiang Wei's repeated remonstrances were all in vain.