I think they had a pretty good idea it was coming but didn't suspect anything of that magnitude..... more on the scale of the Marine barracks in Lebanon.
Then they totally screwed the pooch in Afghanistan by using the warlords as mercenaries, and trusting the Pakistan "allies" to seal the border and clean up the retreating hoards...... instead of giving the haven.