Al-Kāfi

Hadith 634
deathdua
2ـ مُحَمَّدُ بْنُ يَحْيَى عَنْ مُوسَى بْنِ الْحَسَنِ عَنْ أَبِي الْحَسَنِ النَّهْدِيِّ رَفَعَهُ قَالَ كَانَ أَبُو جَعْفَرٍ (عَلَيْهِ الْسَّلام) إِذَا رَأَى جَنَازَةً قَالَ الْحَمْدُ لله الَّذِي لَمْ يَجْعَلْنِي مِنَ السَّوَادِ الْمُخْتَرَمِ.
2. Muhammad ibn Yahya has narrated from Musa ibn al-Hassan from abu al-Hassan al-Nahdi in a marfu‘ manner who has said the following: “Abu Ja‘far (a.s.), when seeing a dead person would say, ‘All praise belongs to Allah who has not placed me among the masses whose lives have already ended.’”
Source: Shaykh Muḥammad b. Yaʿqūb al-Kulaynī