Jabir bin Abdullah reported,

The Messenger of Allah ﷺ would not perform the funeral prayer over a man who died while owing a debt. A deceased man was brought before him, and he asked, "Does he owe any debt?"They replied, "Yes, two dinars."He said, "Pray over your companion."Abu Qatada al-Ansari then said, "I will take them upon myself, Messenger of Allah."So the Messenger of Allah ﷺ prayed over him.Later, when Allah granted victory to His Messenger ﷺ, he said, "I am closer to every believer than his own self. Whoever leaves a debt, its repayment is upon me, and whoever leaves wealth, it belongs to his heirs."

Azami 3752

Sahih

عن جابر قال

كان رسول الله ﷺ لايصلي على رجل مات وعليه دين، فأتي بميت فقال: أعليه دين؟ قالوا: نعم، ديناران، قال: صلوا على صاحبكم، فقال أبو قتادة الأنصاري: هما علي يا رسول الله، قال: فصلى عليه رسول الله ﷺ، فلما فتح الله على رسوله ﷺ قال: أنا أولى بكل مؤمن عن نفسه، فمن ترك دينا فعلي قضاؤه، ومن ترك مالا فلورثته.

الأعظمي 3752صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Funerals
Chapter
Prayer over the deceased
Section
Abrogation of not praying over one who died while owing a debt
Numbering
Jami al-Kamil 3752 (2nd edition)
Azami 3752