There are some post-perestroika witnesses who were in a position to know, and say that Stalin was seriously freaked out and caught off guard. Saw it on History Channel program about transporting Hitler’s, Eva’s and the Goebels’ remains over half of Russia, with the people who did it providing their stories. Hitler’s skeleton ended up in the Kremlin.
Yes, he was caught off guard. He didn’t think the Germans would attack when they did.
If you saw the movie “Stalin” (with Robert Duval), it portrayed Stalin and locking himself in his room alone, for the first few weeks after the invasion, after Voroshilov, told Stalin to his face, that it was his fault. He had to be coaxed by the other members of the Politburo, to finally emerge and make a broadcast to the people.