God had given instructions to Moses that he will visit the sins of the fathers onto the children
Exodus 20:5 NIV
5 You shall not bow down to them or worship them; for I, the Lord your God, am a jealous God, punishing the children for the sin of the parents to the third and fourth generation of those who hate me,
We actually see the judgements carried out on children after the pronouncement of Moses at mount Sinai
Numbers 14:33 NIV
33 Your children will be shepherds here for forty years, suffering for your unfaithfulness, until the last of your bodies lies in the wilderness.
Joshua 7:
Joshua said, “Why have you brought this trouble on us? The Lord will bring trouble on you today.” Then all Israel stoned him, and after they had stoned the rest, they burned them.
But later in Jeremiah God actually says that everyone shall die for his own sins
Jeremiah 31:29-30 NIV
29 “In those days people will no longer say,
‘The parents have eaten sour grapes, and the children’s teeth are set on edge.’
30 Instead, everyone will die for their own sin; whoever eats sour grapes—their own teeth will be set on edge.
Did God change his mind?