וַיֹּ֤אמֶר יְהוָה֙ אֶל־קַ֔יִן אֵ֖י הֶ֣בֶל אָחִ֑יךָ וַיֹּ֙אמֶר֙ לֹ֣א יָדַ֔עְתִּי הֲשֹׁמֵ֥ר אָחִ֖י אָנֹֽכִי׃
האָט גאָט געזאָגט צו קַיִנען: װוּ איז דײַן ברודער הֶבל? האָט ער געזאָגט: איך װײס ניט; בין איך דען דער שומר פֿון מײַן ברודער?
Rashi
“They have come to me from a distant country” This is one of three people whom the Holy One, blessed be He, tested and found to be a chamber pot: Cain, Hezekiah, and Balaam. Hezekiah should have replied, “You are a prophet of the Omnipresent. Yet you ask me?” Instead, he commenced to become haughty, and said, “They have come to me from a distant country.” Therefore, he was punished, and because he rejoiced over them and fed them on his table. Similarly, Balaam, to whom He said, “Who are these men with you?” (Num 22:9) And he replied and said, “Balak the son of Zippor sent them to me.” Similarly, Cain, to whom He said, “Where is your brother Abel?” (Gen. 4:9) He should have replied, “Lord of the Universe, are not all hidden things revealed to You?” As it is stated in Tanhuma.
Or HaChaim
ויאמר השם לא ידון רוחי. G'd said: "My spirit will not abide in man permanently." This verse needs someone to explain it. Our sages have given numerous explanations to it without explaining the plain meaning of the verse. It appears that the Torah wishes to tell us that a change occurred in G'd's dealing with man. During the lifetime of Adam, Eve, Cain and Abel, G'd personally had rebuked man for any misdemeanour. When man's deeds became increasingly repulsive to G'd, He decided not to deal with them on such an intimate basis.
Rashi
איכה WHERE ART THOU — He knew where he was, but He asked this in order to open up a conversation with him that he should not become confused in his reply, if He were to pronounce punishment against him all of a sudden. Similarly in the case of Cain, He said to him, (4:9) “where is Abel thy brother?” Similarly with Balaam, (Numbers 22:9) “what men are these with thee?” — to open up a conversation with them; so, also, in the case of Hezekiah with reference to the messengers of Merodach-baladan (Isaiah 39:3).
Rabbeinu Bahya
צוטריטלעך נאָר פֿאַר פּרעמיום־מיטגלידערDa'at Zekenim
צוטריטלעך נאָר פֿאַר פּרעמיום־מיטגלידערRashi
”They came from a distant land.” This is one of the three [men] whom the Holy One, Blessed Is He, tested and found them to be a pot of muddy water: [The three are,] Kayin, Chizkiyohu and Bilam. Kayin [said], “I don't know, am I my brother's keeper?”15Bereishis 4:9. He should have said, ”Master of the Universe are all hidden things not revealed to You?” as it is [stated] in [Midrash] Tanchuma. Bilam, when the Omnipresent said to him, ”Who are these men with you?”16Bamidbar 22:9. he should have said, “Adonoy God, You know!” as it is stated concerning Yechezkeil,17Yechezkeil 37:3. but he replied arrogantly, ”Balak son of Tzippor, king of Moav, sent them to me,”18Bamidbar 22:10. [i.e.,] many people seek me. Chizkiyohu should have replied to Yeshayohu, ”You are the prophet of the Omnipresent, yet you are asking me?” [Instead,] Chizkiyohu began to become haughty, and said, ”They came to me from a distant land.”19Yeshayohu 39:3. Therefore, he was punished, and also [he was punished] because he rejoiced over them,20God's wrath was mainly because Chizkiyohu distracted his visitors from God's glory by seeking to impress them with his own wealth. See II Divrei Hayomim 32:25. and served them at his table.