scouts can see an army if they are inside the gates, it was just warrior spamming that didn't show them with closed gates. However, scouts do not always give a full report. They could have either missed that information, or he could have reinforced himself from another town or from a valley, or one of his allies could have, in between the time when you scouted and the time when the attacks landed. The level of your beacon versus the level of the enemy's town hall has a big impact. You can avoid missing reinforcements also by sending more scouts to land shortly before your army hits, then they will see if he was reinforced--unless he does it literally at the last second.