Ibn Abī al-Dunyā recorded it in Qasr al-Amal (31–32/11), as did Abū Nuʿaym on his authority; and al-Rāmahurmuzī narrated it in al-Amthāl (170/74).
Abū Ghassān Mālik ibn Ismāʿīl also narrated it; al-Bayhaqī recorded it in al-Zuhd (190/457).
This is a good chain of transmission. Its narrators are trustworthy and are among those used by both al-Bukhārī and Muslim, apart from ʿAlī ibn ʿAlī al-Rifāʿī. There is some minor criticism concerning him, but it does not lower his hadith below the rank of good, as I established in Irwāʾ al-Ghalīl (2/51–52). For this reason, al-Ḥāfiẓ al-ʿIrāqī said in Takhrīj al-Iḥyāʾ (4/453):
“Ahmad, Ibn Abī al-Dunyā in Qasr al-Amal, and al-Rāmahurmuzī in al-Amthāl recorded it ... Its chain is good. Ibn al-Mubārak recorded it in al-Zuhd, as did Ibn Abī al-Dunyā, through the mursal narration of Abū al-Mutawakkil.”
His student al-Haythamī said in al-Majmaʿ (10/255):
“Ahmad narrated it. Its narrators are those of the Ṣaḥīḥ collections, apart from ʿAlī ibn ʿAlī al-Rifāʿī, who is trustworthy.”
The mursal report to which al-Ḥāfiẓ al-ʿIrāqī referred was recorded by Ibn Abī al-Dunyā (31/10), Ibn al-Mubārak in al-Zuhd (86/254), and likewise Wakīʿ in al-Zuhd (2/436/189). The latter two said: ʿAlī ibn ʿAlī informed us, from Abū al-Mutawakkil, who said:
“The Messenger of Allah, peace and blessings be upon him, took three sticks. He planted one before him and another beside it; as for the third, he placed it farther away. Then he said ...” and he cited it in similar wording, adding:
“... That is hope, which the son of Adam pursues, but his appointed term snatches him away before he attains it.”
The wording is Ibn al-Mubārak’s. The other two word it: “... before he attains his hope.”