The human soul is so inevitably the victim of pain that is suffers the pain of the painful surprise even with things it should have expected. A man who has always spoken of fickleness and unfaithfulness as perfectly normal behaviour in women will feel all the devastation of the sad surprise when he discovers that his sweetheart has been cheating on him, exactly as if he’d always held up female fidelity and constancy as a dogma or a rightful expectation. Another man, convinced that everything is hollow and empty, will feel like he’s been struck by lightning when he learns that what he writes is considered worthless, or that his efforts to educate people are in vain, or that it’s impossible to communicate his emotion.—Fernando Pessoa. "245". The Book of Disquiet. Translated by Richard Zenith.
Offhandedly it seems like a rupture in personal logic—to be surprised by the thing you were ostensibly expecting. But that makes an assumption: that you were really expecting that difficult or bad thing to happen.
I think, at least sometimes, that expected pain is a talisman to ward against the pain coming—like taking an umbrella not to keep the rain off your head, but to keep the rain in the cloud. Maybe the right word or thought or action will keep the bad things away.
Probably not, but it's worth a shot.