The old testament is full of stories that do not have fairy tale endings, or at least it does not seem that way. Josiah was a humble man who courageously followed after God, until the event that led up to his death.
After all this, when Josiah had prepared the temple, Neco king of Egypt went up to fight at Carchemeish on the Euphrates and Josiah went out to meet him. But he sent envoys to him, saying, "What have we to do with each other, king of Judah? I am not coming against you this day, but against the house with which I am at war. And God has commanded me to hurry. Cease opposing God, who is with me, lest he destroy you." Nevertheless, Josiah did not turn away from him, but disguised himself in order to fight with him. he did not listen to the words of Neco from the mouth of God, but came to fight with him. He did not listen to the words of Neco from the mouth of God, but came to fight in the plain of Megiddo. And the archers shot King Josiah. And the king said to his servants, "Take me away, for I am badly wounded." So his servants took him out of the chariot and carried him in his second chariot and brought him to Jerusalem. And he died and was buried in the tombs of his fathers (2 Chron. 35:20 - 27).Josiah did not obey the voice of God, spoken through Neco king Egypt, and he paid with his life. This does not seem like the perfect ending to this story, until we remember how God sees the life of Josiah. This is how the life of Josiah is summarized, "He did what was right in the eyes of the LORD, and walked in the ways of David his father; and he did not turn aside to the right hand or to the left (2 Chron. 34:2)." We see God's mercy shining through once again. Even though Josiah failed, God still considered him a man who followed after him wholeheartedly.