If someone kills himself by mistake, there is no Diya
باب إِذَا قَتَلَ نَفْسَهُ خَطَأً فَلاَ دِيَةَ لَهُ
Sahih al-Bukhari, Book of Blood Money (Ad-Diyat)(view book)
Sahih al-Bukhari 6891
Narrated Salama:
We went out with the Prophet to Khaibar. A man (from the companions) said, "O 'Amir! Let us hear some of your Huda (camel-driving songs.)" So he sang some of them (i.e. a lyric in harmony with the camels walk). The Prophet ﷺ said, "Who is the driver (of these camels)?" They said, "Amir." The Prophet ﷺ said, "May Allah bestow His Mercy on him !" The people said, "O Allah's Apostle! Would that you let us enjoy his company longer!" Then 'Amir was killed the following morning. The people said, "The good deeds of 'Amir are lost as he has killed himself." I returned at the time while they were talking about that. I went to the Prophet and said, "O Allah's Prophet! Let my father be sacrificed for you! The people claim that 'Amir's good deeds are lost." The Prophet ﷺ said, "Whoever says so is a liar, for 'Amir will have a double reward as he exerted himself to obey Allah and fought in Allah's Cause. No other way of killing would have granted him greater reward."
حَدَّثَنَا الْمَكِّيُّ بْنُ إِبْرَاهِيمَ، حَدَّثَنَا يَزِيدُ بْنُ أَبِي عُبَيْدٍ، عَنْ سَلَمَةَ، قَالَ خَرَجْنَا مَعَ النَّبِيِّ ﷺ إِلَى خَيْبَرَ فَقَالَ رَجُلٌ مِنْهُمْ أَسْمِعْنَا يَا عَامِرُ مِنْ هُنَيْهَاتِكَ. فَحَدَا بِهِمْ، فَقَالَ النَّبِيُّ ﷺ " مَنِ السَّائِقُ " قَالُوا عَامِرٌ. فَقَالَ " رَحِمَهُ اللَّهُ ". فَقَالُوا يَا رَسُولَ اللَّهِ هَلاَّ أَمْتَعْتَنَا بِهِ. فَأُصِيبَ صَبِيحَةَ لَيْلَتِهِ فَقَالَ الْقَوْمُ حَبِطَ عَمَلُهُ، قَتَلَ نَفْسَهُ. فَلَمَّا رَجَعْتُ وَهُمْ يَتَحَدَّثُونَ أَنَّ عَامِرًا حَبِطَ عَمَلُهُ، فَجِئْتُ إِلَى النَّبِيِّ ﷺ فَقُلْتُ يَا نَبِيَّ اللَّهِ فَدَاكَ أَبِي وَأُمِّي، زَعَمُوا أَنَّ عَامِرًا حَبِطَ عَمَلُهُ. فَقَالَ " كَذَبَ مَنْ قَالَهَا، إِنَّ لَهُ لأَجْرَيْنِ اثْنَيْنِ، إِنَّهُ لَجَاهِدٌ مُجَاهِدٌ، وَأَىُّ قَتْلٍ يَزِيدُهُ عَلَيْهِ ".