Exodus 33:11 Then the Lord would speak to Moshes face to face, as a man would speak to his companion, and he would return to the camp, but his attendant, Joshua, the son of Nun, a lad, would not depart from the tent.
Gemora Temurah 16a – Rabbi Yehuda said in the name of Rav: At the time that Moshe was about to die, he said to Joshua, “Ask me about any doubts that you have.” Joshua replied, My Master, have I ever left you for one hour and gone elsewhere? Did you not write concerning me in the Torah: “But his servant Joshua the son of Nun would not depart from the tent”? Immediately his strength weakened and he forgot three hundred laws and there arose [in his mind] seven hundred doubts.
Torah Temimah Colloquial Translation on Note #17:
It is explained in the Gemora that it was Moses whose strength got weaker and that there were immediately forgotten 300 laws. Rashi explains that it refers to Joshua [forgetting the 300 laws]. In other words, Moses was distraught that Joshua was as great as he was, and because of the pain caused to Moshe, Joshua was punished.
But, in my opinion, this does not make sense. It does not sound likely that Moshe would be distraught by Joshua’s greatness. Wasn’t it Moshe who said [in the episode with Eldad and Medad] that HaShem gives the power of prophesy to who He sees fit and, in fact, all of the people are prophets?
Therefore, it seems more appropriate to say that the text should read that Joshua’s strength got weaker and that it was Joshua who forgot all these laws. In other words, Joshua was punished because of his hubris in saying that there was not a single thing that he had a question about.
Editor’s Note: In this note, the Torah Temimah disagrees with Rashi’s explanation and suggests that there might be a textural error in the Gemora.