It came like a bolt from the blue
A complete and sudden surprise.
The allusion here is to the surprise like a lightening bolt from a clear sky. Thomas Carlyle was the first author known to have used the term in print, in his The French Revolution, 1837:
"Arrestment, sudden really as a bolt out of the Blue, has hit strange victims."
The word blue (or blew) had been used before that to mean the sky. Henry More records that in his A Platonicall Song of the Soul, 1642:
"Ne any footsteps in the empty Blew."