II Kings 22 narrates the discovery of a Torah scroll during Josiah's reign, his distress at the harrowing threats therein, and his emissary to the prophetess Hulda about their credibility in his day, given Judah's sinfulness.
Hulda tells him that, Judah's sinfulness not withstanding, Josiah's contrition will spare him the sight of God's now impending wrath and end his life in peace. In verse 20 specifically, Hulda predicts
לכן הנני אספך אל עמך ונאספת אל קברתיך בשלום ולא תראינה עיניך בכל הרעה אשר אני מביא על המקום הזה וישיבו את המלך דבר
Therefore I will gather you unto your people and you shall be gathered unto your grave in peace and your eyes shall not see the evil that I am bringing on this place. And the brought this matter to the king.
II Chronicles 34:25 repeats this prediction for Josiah almost verbatim.
After a fruitful reign, Josiah was killed by Egyptian archers after refusing to allow Pharaoh Necho to pass through his land to do battle at Carchemish on the Euphrates, as detailed in II Kings 23 and II Chronicles 35.
Necho's invasion essentially spelled the end of Judean independence. The heir apparent was taken to Egypt and imprisoned and Josiah's other son was installed on the throne as an Egyptian tributary. Egypt's dominance over Judah segued into Babylon's which ended in the temple's destruction.
Josiah was buried with his fathers, but his battle with Necho was the beginning of the end for his people, and he dies of battle wounds. These events seem to contradict Hulda's prophecy for Josiah's peaceful death and him not seeing his country's ruin.
Is Hulda's prophecy for Josiah considered not fulfilled, or are there interpretations that find it realized?