Food officer Li Yan falsely reported that the grain was exhausted due to delays in transporting supplies, intending to force Zhuge Liang to retreat. Zhuge Liang knew it was a lie, but to avoid shaking the army's morale, he had no choice but to order the army to return. After returning to Hanzhong, an investigation confirmed that Li Yan had fabricated military intelligence, and he was stripped of his rank and reduced to commoner status. Although this northern expedition captured two commanderies, it failed to achieve complete success due to issues with food supplies. Unwilling to accept defeat, Zhuge Liang reorganized his troops and prepared to advance again.
Soon after, Zhuge Liang learned that Hao Zhao was firmly defending Chencang, so he led a large army to march out through Mount Qi again. Wei general Wang Shuang challenged the Shu army but was killed by Zhuge Liang. Zhuge Liang attacked Chencang several times without success; upon hearing that Sima Yi was coming to reinforce, he withdrew his troops and camped at Lucheng. Sima Yi pursued him but was defeated by an ambush. The Wei and Shu armies confronted each other, with victories and defeats on both sides.
Seeing that Sima Yi was firmly entrenched, Zhuge Liang employed a stratagem of sowing discord, sending people to spread rumors that Sima Yi was secretly communicating with Shu. Cao Rui became suspicious, recalled Sima Yi, and sent Cao Zhen to command the forces against Shu instead. Cao Zhen underestimated the enemy and attempted to divide his troops for a deep advance, but fell into Zhuge Liang's ambush, suffered a major defeat, and died of grief and anger. Having no other choice, Cao Rui had to reactivate Sima Yi as Grand Commander to resist Zhuge Liang. Sima Yi resumed command and faced Zhuge Liang in a standoff at Mount Qi. Zhuge Liang lured Wei generals Fei Yao and Dai Ling deep into Shu territory and captured them alive. He also set up an ambush at Jigu Valley, trapping Wei general Zhang He.
Zhang He repeatedly tried to break out but failed, leaving the Wei army in a difficult situation. However, the Shu army's supply routes were long, and combined with days of continuous rain, food supplies ran short. With no other choice, Zhuge Liang ordered the army to withdraw and return to Hanzhong. Upon hearing that Zhuge Liang was retreating, Sima Yi wanted to pursue. Zhang He advised: 'Do not intercept an army returning home; do not pursue a desperate foe.' 'The Chancellor's retreat must be a ruse.' Sima Yi disregarded this advice and forcefully ordered Zhang He to lead troops in pursuit.