I read an article a while ago saying that the Japanese made a major error. It said that the leader of the attack did not order the planes to follow the surprise achieved plan like he should have. Instead he sent the enemy aware signal.
The result was that the slow flying to torpedo planes were left to attack a fully alerted base and took losses. And the dive bombers attacked the wrong ships and did less damage than they should have.