In Sanhedrin 104, the members of the Great Assembly decided that Shlomo does not deserve a share in the World to Come.
[Sages enumerated a list of kings that do not deserve a share in Olam Habah] Rav Ashi says: The members of the Great Assembly enumerated them. Rav Yehuda says that Rav says: They sought to enumerate one more, King Solomon...
A Divine Voice emerged and said to the members of the Great Assembly: ... "Therefore, “he shall stand before kings; he shall stand not before obscure men,” and it is inappropriate to enumerate him among the wicked.
Why did the Sages consider King Solomon so wicked that he lost his share in the WTC?