As Huan Xuan grew in age, he became ambitious and wanted high posts, but the imperial government was highly suspicious of him and did not give him governmental posts until 391, when he became an assistant to Emperor Xiaowu's crown prince Sima Dezong (later Emperor An). Around this time, he had an encounter with Emperor Xiaowu's younger brother Sima Daozi, the Prince of Kuaiji, that went badly—as at one feast where Sima Daozi invited Huan Xuan as a guest, after Sima Daozi became drunk, he made the statement, "Was it not true that when Huan Wen became old, he planned treason?" Huan Xuan was so struck by the statement that he fell prostrate on the ground, fearing that Sima Daozi would kill him, and from this point he bore a grudge against the prince. Eventually, Huan Xuan became the governor of Yixing Commandery (義興, roughly modern Wuxi, Jiangsu), but felt that the post was not sufficient for his talent, and he therefore resigned and returned to his dukedom, and he wrote a report to Emperor Xiaowu that was highly accusatory in tone in which he claimed that Emperor Xiaowu had much to owe to Huan Wen, and Emperor Xiaowu ignored the report.