The Torah tells us Reuben came back to the pit, found it empty, and tore his clothes. Targum Pseudo-Jonathan on (Genesis 37:29) answers the question readers have always wanted to ask: where was Reuben when the sale actually happened?
He was fasting in the hills. Specifically, he had sat fasting on account that he had confounded the couch of his father. The Targum loops us back to the Bilhah incident from (Genesis 35:22). Reuben had been doing teshuvah — penitential fasting, sitting apart, wrapped in sackcloth — for that old sin ever since his father heard of it.
On this particular day, the day of the sale, Reuben had stepped away from the brothers to continue his repentance. He planned to return at night, alone, and pull Joseph from the pit secretly — that he might return to the pit and bring him up for his father, if haply he might avert his anger. His repentance and his rescue mission were braided together. Save the brother, calm the father, close one wound while opening another.
And then he returned to an empty pit.
The sages saw a profound tragedy in the timing. Reuben was doing two righteous things at once — repenting for his past and planning to rescue his brother — and the combination made him late. The Targumist does not blame him. But the lesson sits heavily. Teshuvah is holy work. It is also sometimes the work that keeps us from the work in front of us. The eldest son rent his garments not only for Joseph, but for the terrible realization that a good man, doing a good thing, had still arrived too late.