They bombed Pearl Harbor knowing that no carriers were docked there at the time. American carriers were not the main objective of the attack. You have to realize carriers were relatively new and not a known commodity like they are today.
I don't think Japan was happy to discover that they'd missed all of the US's carriers. I think I've read that Yamato was furious, in fact.
Ironically, they still held to this strategy in 1944, and attacked the US Navy in the Battle of Leyte Gulf to force their missing decisive battle, using their carrier fleet entirely as a decoy force. Even after there had been only one battleship action in the entirety of the Pacific war to this point, with all other major naval battles involving only the carriers on one or both sides.