I feel like your beacon tower level isn't good enough to see everything.

That being said, scouts can see units that are on their way back to the city, so you should've scouted a minute or two prior to the attack to see whether there were any reinforcements coming/there already.

The fact that you didn't means he got reinforced and your army got kicked.