This is because the general in charge, who had set up defensive lines in an ideal location, found out that another unit was preemptively retreating, become irrationally paranoid about the (extremely remote) possibility of being flanked, and from there panicked himself into a headlong retreat...