Seldon missed The Mule, pretty big failure of psychohistory right there.
Mule-like occurrences were always a possibility, which is why Seldon also created the Second Foundation to fix the bug and set the plan back on track- which of course they did. Things were a bit touch-and-go for a while there, but the possibility of failure is always a consequence of probabilistic modeling