The more I read about US intelligence specifically before Pearl harbor, authors tend to fall into two camps.
Those like Wohlstetter state that we had enough intelligence to conclude of an attack, and it was improper analysis or underestimating by our national leaders.
Other view that the US didn't throw well enough resources and funding to properly find out about the attack beforehand.
So what exactly was the cause for the US being surprised by the Attack on pearl harbor?
First, you have to understand there's a huge difference between knowing the Japanese would attack and knowing that the Japanese would attack Pearl Harbor. A large part of why the attack was such a surprise is that it was an extremely daring raid that few would even attempt. Hawaii is over 4,000 miles from Japan. In order to attack Pearl Harbor, the Japanese had to cross a considerable distance undetected and operate at the very limits of their logistical capabilities. So while there were people who considered by an attack likely, an attack on Pearl Harbor was generally considered highly unlikely due to the risks and difficulties involved. Most considered the Philippines to be the most likely target.
Second, US intelligence on Japan came almost exclusively from signals intelligence. Prior to the attack, the US could read Japanese diplomatic communications with relative ease but Japanese naval codes remained much more difficult to decipher. In December 1941 only 10-15% of each naval message could be understood by US intelligence. Since Japanese diplomats were kept out of the loop, US signals intelligence had no way of figuring out about the plan.
Finally, even if the US had pushed a much more robust intelligence collection effort it's not clear that they would have figured out about the attack. The Imperial Japanese Navy maintained very strict secrecy surrounding the attack; information was kept on a need-to-know basis, training areas were kept off-limits to foreigners, messages never mentioned Pearl Harbor by name and the strike force maintained strict radio silence the whole way. Even the majority of senior officers tasked with carrying out the attack weren't notified until November 17, 1941. The Japanese also engaged in deception by leaving their radio operators behind and having them broadcast false signals to give the impression that the carriers were still in home waters.
Intelligence is an extremely difficult field and it's easy to judge with the benefit of hindsight.
Sources:
https://www.cia.gov/library/center-for-the-study-of-intelligence/kent-csi/vol9no4/html/v09i4a07p_0001.htm http://www.historynet.com/attack-on-pearl-harbor-why-werent-we-warned.htm https://www.usni.org/magazines/navalhistory/2009-12/how-japanese-did-it