He did not take seriously the words of Necho which he had received from God. (2 Chronicles 35:22)
I was really struck by this passage of scripture this morning. Josiah was a remarkable king. He was a man who followed hard after God and desired righteousness. When he heard the Law of God, he was cut to the heart and followed God's law to the very letter.
No king before or after repented before the LORD as he did, with his whole heart, soul, and being in accordance with the whole law of Moses. (2 Kings 23:25)
And yet in the end, he died ingloriously in a battle that he should not have fought. While he obeyed the Law of God, he did not heed God's voice.