The first thirteen verses of chapter 20 of the book of Numbers, which are part of this parashah, describe a small story of that is very difficult to understand. The people demand water from Moses and Aaron. The brothers leave the unruly crowd and go to the Tabernacle. God reveals himself to them and tells Moses to take his staff, go to a certain rock and speak to it. Then water will flow with which the people and their livestock will satisfy their thirst. Moses went to the rock and rebukes the people, saying: “listen, you rebels: must we get you water from this rock?” He then hits the rock, and the water flows. God then speaks to Moses and Aaron, telling them that because they had not consecrated Him properly among the people, they would die in the desert and not bring the people into the land of Israel.
What has Moses done wrong? There are countless interpretations about this. In the book of Psalms (106: 32-33) it says that his sin was his angry reprimand to the people. Maimonides agrees with this interpretation (Chapter 6 of Shemona Perakim). Rashi maintains that he should have spoken to the rock and not hit it; Nachmanides says that he should not have said "we have to draw water" but "God will draw water for you." Both Luzzato and Sforno (20: 7) emphasize in their exegesis the difficulty in interpreting the text.
Whatever Moses' error was, the punishment he received seems excessive. The sages of the Midrash were sensitive to this question and explained that Moses could not leave his flock, even after death (Bemidbar Raba, Parasha 19, Siman 3). He saw the land of Canaan from Mount Nebo, where the generation of free people he had formed was going to build its home, but he did not enter it. It was his last great lesson to the people: all efforts that are made in life must have the purpose that those who come after us can live with more dignity and spiritual depth.