What is the meaning of [went pear-shaped]

Sarah’s surprise party went pear-shaped (fail) once she accidentally found out about it.