I'm finding a lot of contradicting information, although I might be interpreting it wrong. From what I understand it is one of these options:
They had no idea.
They knew Germany would attack, but didn't believe it would be so soon, so they weren't prepared yet.
So I think the most common interpretation is that the Soviets received numerous pieces of intelligence suggesting that a German attack would occur in 1941, but political leadership at the highest levels discounted the information. It is actually characteristic of all of the Soviet intelligence agencies for most of the history of the Soviet Union, pre and post war, to have relatively strong intelligence collection but to misinterpret the political information (although not science and technical information) received due to political direction from the highest level. In 1941, in the aftermath of a purge of the army and intelligence services, this tendency was at it's most acute.
Stalin's intuition was that the Germans would wait until the war in the west was more settled to turn east. Once the NKVD and GRU understood Stalin's views, they distorted the information reported to him and he in turn gave them reason to believe that information contradicting his views would not be well received or believed. He wrote the following minutes on a briefing from the GRU: "You can send your 'source' from the German Air Force to his whore of a mother! This is not a 'source but a disinformer." and described highly placed agent Richard Sorge as a lying "shit who has set himself up with some small factories and brothels in Japan." So Stalin can fairly be said to be mostly responsible for the intelligence failure. Additionally, the idea that Western intelligence agencies were fabricating evidence to try and provoke a Russian movement of troops to the border (and a German response) was much discussed and given wide credence by Stalin and high levels of Soviet intelligence. To forestall this supposed plot, discussion of imminent German invasion was discouraged among senior military and intelligence officers, and the environment of the army after the purge was not conducive to preparations on individual initiative.
Source for this is Christopher Andrew's "The Sword and The Shield"