2 Chronicles 34:26

And as for the king of Judah, who sent you to enquire of the LORD, so shall ye say unto him, Thus saith the LORD God of Israel concerning the words which thou hast heard;

This verse opens God's answer through the prophetess to the king of Judah after the book of the law was found and Josiah sent his officials to inquire of the Lord for himself and for his people concerning the words he had heard. The inquiry was sent because when Josiah heard the words of judgment written against the place and its inhabitants, he recognized that Israel had departed from God's statutes.

Because his heart was tender, he humbled himself before God when he heard, tearing his clothes and weeping before Him, and God heard him. God promised to gather him to his fathers in peace, so that his eyes would not see all the evil to be brought upon the place and its inhabitants. The inquiry then led to public recognition of sin, repentance, and covenant renewal, for Josiah gathered all the elders of Judah and Jerusalem and went up to the house of the Lord with all the men of Judah and Jerusalem and the priests and Levites and all the people great and small. There he read in their ears all the words of the book of the covenant found in the house of the Lord, stood in his place and made a covenant before the Lord to walk after the Lord and to keep His commandments and testimonies and statutes with all his heart and soul to perform the covenant words, caused all present in Jerusalem and Benjamin to stand to it, took away all the abominations from all the countries of Israel, and made all present in Israel serve the Lord their God, and all his days they did not depart from following the Lord.

In this Josiah did a good work in putting down and apparently uprooting idolatry, reopening the temple, and re-establishing the sacrificial offerings. His later death in battle was not God denying His word that he should go to the grave in peace, but Josiah's own self-confident failure to honor God's word and heed warning by following his own way into a war God had not ordered him to fight, so that God could not shield him from the consequences. The account teaches that when God's law reveals wrongdoing, people must humble themselves, repent, reform, and return to obedience.