Jeremiah 18:10
If it do evil in my sight, that it obey not my voice, then I will repent of the good, wherewith I said I would benefit them. If it do evil in my sight, that it obey not my voice, then I will repent of the good, wherewith I said I would benefit them.
God's promised good to a nation is conditional on obedience, so that if it does evil in His sight and does not obey His voice, He will withdraw the good He said He would do for it. The nation is in God's hand like clay in the potter's hand and subject to His rule, so His dealings with it respond to its conduct. In its setting the verse warns Judah and Jerusalem to turn from evil, but they reject the call and resolve to follow their own ways and devices, bringing judgment upon themselves.
The virtues of ancestors cannot protect descendants who choose evil, because God's dealings with nations depend on their own course of action. God warns and pleads with His people to stop doing evil and learn to do well, and those who follow Him in righteousness receive the promised blessings, while those who choose their own ways prove unfaithful and cannot be blessed. The warning calls each person to turn from evil and make ways and actions good, and in this personal application repentance can save the sinner from death. Professed believers who dishonor God and lead others astray must heed this warning, and God's work will prevail despite opposition.