Solomon might have started well as King of Israel, but he didn’t end well:
1 Kings 11:1-8 King Solomon, however, loved … seven hundred wives of royal birth and three hundred concubines, and his wives led him astray. … [they] turned his heart after other gods, and his heart was not fully devoted to the Lord his God, as the heart of David his father had been. … On a hill east of Jerusalem, Solomon built a high place for … all his foreign wives, who burned incense and offered sacrifices to their gods.
He would have had to have known the rules for kings in the law (Deuteronomy 17:16-20), but despite his wisdom, failed to keep them.
Three of Asaph’s psalms show Asaph’s grief at the unrestrained wickedness and imminent tearing apart of Israel.