The way I heard it, a big flaw on their end of it was NOT following a plan, but engaging in a little too much impromptu, on the fly reaction. Break out the planes...no wait, hold the planes...
I forget exactly. I read about it, and saw the earlier ('76) film.
In any case, cracking the code was the essential ingredient. That plus Japanese sense of invincibility. That's fine on the lower levels but not up where the strategy is conceived.
There's a bit more to it than that.
From the IJN SOP, the CAP planes got priority on the decks, and also IJN doctrine, you don't start staging a strike during an attack, and all the ad hoc US attacks kept the Japanese from being able to stage and launch a coordinated attack.