Judges 1: 19: And the LORD was with Judah; and he drave out the inhabitants of the mountain; but could not drive out the inhabitants of the valley, because they had chariots of iron.
The promise of victory over iron chariots was only given to the house of Joseph.
Joshua 17: 17 - 18: And Joshua spake unto the house of Joseph, even to Ephraim and to Manasseh, saying, Thou art a great people, and hast great power: thou shalt not have one lot only: But the mountain shall be thine; for it is a wood, and thou shalt cut it down: and the outgoings of it shall be thine: for thou shalt drive out the Canaanites, though they have iron chariots, and though they be strong.
Judah drove out the inhabitants of the mountains, but it could not drive out the inhabitants of the valley because they had chariots of iron; the promise of victory over the iron chariots belonged to the house of Joseph.
God was with Judah despite its failure for victory in the valley; it was not God that was beaten by the iron chariots, but Judah, because the complete victory did not belong to them.