وَعَنْ أَبِي قَتَادَةَ رَضِيَ اللَّهُ عَنْهُ قَالَ: قَالَ رَجُلٌ: يَا رَسُولَ اللَّهِ! أَرَأَيْتَ إِنْ قُتِلْتُ فِي سَبِيلِ اللَّهِ صَابِرًا مُحْتَسِبًا مُقْبِلًا غَيْرَ مُدْبِرٍ، يُكَفِّرُ اللَّهُ عَنِّي خَطَايَايَ؟ فَقَالَ رَسُولُ اللَّهِ ﷺ: «نَعَمْ». فَلَمَّا أَدْبَرَ نَادَاهُ فَقَالَ: «نَعَمْ إِلَّا الدَّيْنَ، كَذَلِكَ قَالَ جِبْرِيلُ». (Reported by Muslim)
Translation: Abu Qatadah reports that a man asked whether his sins would be expiated if he were killed in Allah's cause while patient, hoping for reward and not turning back. The Prophet ﷺ first said yes, then called him back to clarify: yes, except for debt; Jibril had conveyed the same exception.
The account puts outstanding financial obligations beside the discussion of a very great sacrifice. Performing a good deed does not cancel another person's right to be repaid or the duty to resolve that obligation.