The innocent swept along by the guilty – Re’eh
There is a moral problem with the harsh punishment of a city that has turned to idolatry (Deut. 13:13-17).
Even if most residents are guilty, there is surely a minority that is not swept along by the forces of sin.
Tractate Sanhedrin argues that there never was such a city, but even if it is only hypothetical the moral problem remains. We know it from Sodom and Gomorrah, where God will only save the city if there is a visible minority of righteous people. In its own interest, the minority might find the pressure to conform just too strong.
Painful as it is to leave home, they should leave, to save themselves from bad influences and from being punished for something they did not personally do.