In 779, Emperor Daizong died and was succeeded by his son Emperor Dezong.
While Cui was at Chang'an, Tufan and Nanzhao forces launched a major joint attack against Xichuan Circuit, and Cui's subordinates were unable to fight them off.