Another interpretation: "And God did not let them be comforted." Even though Israel had left Egypt, the Holy One, blessed be He, did not accept consolation over the sons of Ephraim who were killed, who calculated the appointed end and erred and went out thirty years before the end. For they reckoned it from the covenant between the pieces, but the end was from when Isaac was born. A parable of a king who was marrying off his son, and in the midst of the wedding canopy one of his sons died. He said, "It is impossible for me to rejoice, because of my dead son, and it is impossible for me to mourn, because of the joy of my living son." What did he do? He began to dance with one hand and lament with the other. Thus, "and He did not let them be comforted."
God Mourned the Slain Sons of Ephraim Who Left Too Soon
Yalkut Shimoni on Torah 226:3
דָּבָר אַחֵר, וְלֹא נָחָם אֱלֹהִים, אַף עַל פִּי שֶׁיָּצְאוּ יִשְׂרָאֵל מִמִּצְרַיִם לֹא קִבֵּל הַקָּדוֹשׁ בָּרוּךְ הוּא תַּנְחוּמִין עַל בְּנֵי אֶפְרַיִם שֶׁנֶּהֶרְגוּ, שֶׁמָּנוּ הַקֵּץ וְטָעוּ וְיָצְאוּ שְׁלוֹשִׁים שָׁנָה קֹדֶם הַקֵּץ, שֶׁמָּנוּ לְבֵין הַבְּתָרִים, וְהַקֵּץ הָיָה מִשֶּׁנּוֹלַד יִצְחָק, מָשָׁל מֶלֶךְ שֶׁהָיָה מַשִּׂיא בְּנוֹ וּמִתּוֹךְ הַחֻפָּה מֵת לוֹ בֵּן אֶחָד, אָמַר, אִי אֶפְשִׁי בְּשִׂמְחָה מִפְּנֵי בְּנִי הַמֵּת, וְאִי אֶפְשִׁי לְהִתְאַבֵּל מִפְּנֵי שִׂמְחַת בְּנִי הָחַי, וּמֶה עָשָׂה, הִתְחִיל מְרַקֵּד בְּיָדוֹ אַחַת וְסוֹפֵד בְּיָדוֹ אֲחֶרֶת, הֱוֵי וְלֹא נָחָם.