The greatest political humiliation of the year could have been avoided.