Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
tirmidhi:3050ʿAbd b. Ḥumayd > ʿUbaydullāh b. Mūsá > Isrāʾīl > Abū Isḥāq > al-Barāʾ

"A man among the Companions of the Prophet ﷺ died before Khamr had been made unlawful. So when Khamr was made unlawful, some men said: 'How about our companions who died while drinking Khamr?' So (the following) was revealed: Those who believe and do righteous good deeds, there is no sin on them for what the ate, if they have Taqwa and perform good (5:93)."  

Abū ʿĪsá said that this Ḥadīth is Ḥasan-Ṣaḥīḥ.
الترمذي:٣٠٥٠حَدَّثَنَا عَبْدُ بْنُ حُمَيْدٍ حَدَّثَنَا عُبَيْدُ اللَّهِ بْنُ مُوسَى عَنْ إِسْرَائِيلَ عَنْ أَبِي إِسْحَاقَ عَنِ الْبَرَاءِ قَالَ

مَاتَ رِجَالٌ مِنْ أَصْحَابِ النَّبِيِّ ﷺ قَبْلَ أَنْ تُحَرَّمَ الْخَمْرُ فَلَمَّا حُرِّمَتِ الْخَمْرُ قَالَ رِجَالٌ كَيْفَ بِأَصْحَابِنَا وَقَدْ مَاتُوا يَشْرَبُونَ الْخَمْرَ فَنَزَلَتْ ( لَيْسَ عَلَى الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ جُنَاحٌ فِيمَا طَعِمُوا إِذَا مَا اتَّقَوْا وَآمَنُوا وَعَمِلُوا الصَّالِحَاتِ )  

قَالَ أَبُو عِيسَى هَذَا حَدِيثٌ حَسَنٌ صَحِيحٌ

See similar narrations below:

Collected by Tirmidhī, Ibn Ḥibbān
tirmidhi:3052ʿAbd b. Ḥumayd > ʿAbd al-ʿAzīz b. Abū Rizmah > Isrāʾīl > Simāk > ʿIkrimah > Ibn ʿAbbās

"They (the Companions) said: 'O Messenger of Allah, how do you hold those who died while they were drinking Khamr - considering that the prohibition of intoxicants is now revealed?' So, (the following) Ayah was revealed: "Those who believe and do righteous good deeds, there is no sin on them for what they ate (in the past), if they fear Allah and believe and do righteous good deeds."  

Abū ʿĪsá said that this Ḥadīth is Ḥasan-Ṣaḥīḥ.
الترمذي:٣٠٥٢حَدَّثَنَا عَبْدُ بْنُ حُمَيْدٍ حَدَّثَنَا عَبْدُ الْعَزِيزِ بْنُ أَبِي رِزْمَةَ عَنْ إِسْرَائِيلَ عَنْ سِمَاكٍ عَنْ عِكْرِمَةَ عَنِ ابْنِ عَبَّاسٍ قَالَ

قَالُوا يَا رَسُولَ اللَّهِ أَرَأَيْتَ الَّذِينَ مَاتُوا وَهُمْ يَشْرَبُونَ الْخَمْرَ لَمَّا نَزَلَ تَحْرِيمُ الْخَمْرِ فَنَزَلَتْْ ( لَيْسَ عَلَى الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ جُنَاحٌ فِيمَا طَعِمُوا إِذَا مَا اتَّقَوْا وَآمَنُوا وَعَمِلُوا الصَّالِحَاتِ )  

قَالَ أَبُو عِيسَى هَذَا حَدِيثٌ حَسَنٌ صَحِيحٌ

ذِكْرُ مَغْفِرَةِ اللَّهِ جَلَّ وَعَلَا لِمَنْ مَاتَ مِنْ شَرَابِ الْخَمْرِ مِنَ الْمُسْلِمِينَ قَبْلَ نُزُولِ تَحْرِيمِهَا

ibnhibban:5350ʿUmar b. Muḥammad al-Hamdānī > Muḥammad b. Bashhār > Muḥammad > Shuʿbah > Abū Isḥāq > al-Barāʾ

"Some people among the Companions of the Prophet ﷺ died while they had been drinking Khamr. So when it was revealed that it was unlawful, some people among the Companions of the Messenger of Allah ﷺ said: 'How about our companions who died while they were drinking it?' So (the following) Ayah was revealed: Those who believe and do righteous good deeds, there is no sin on them for what they ate (5:93)." (Using translation from Tirmidhī 3051)   

ابن حبّان:٥٣٥٠أَخْبَرَنَا عُمَرُ بْنُ مُحَمَّدٍ الْهَمْدَانِيُّ قَالَ حَدَّثَنَا مُحَمَّدُ بْنُ بَشَّارٍ قَالَ حَدَّثَنَا مُحَمَّدٌ قَالَ حَدَّثَنَا شُعْبَةُ عَنْ أَبِي إِسْحَاقَ عَنِ الْبَرَاءِ قَالَ

«مَاتَ نَاسٌ مِنْ أَصْحَابِ رَسُولِ اللَّهِ ﷺ وَهُمْ يَشْرَبُونَ الْخَمْرَ فَلَمَّا نَزَلَ تَحْرِيمُهَا قَالَ نَاسٌ مِنْ أَصْحَابِ رَسُولِ اللَّهِ ﷺ فَكَيْفَ بِأَصْحَابِنَا الَّذِينَ مَاتُوا وَهُمْ يَشْرَبُونَهَا؟ فَنَزَلَتْ {لَيْسَ عَلَى الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ جُنَاحٌ فِيمَا طَعِمُوا إِذَا مَا اتَّقَوْا وَآمَنُوا وَعَمِلُوا الصَّالِحَاتِ}»  

ذِكْرُ تَحْرِيمِ اللَّهِ جَلَّ وَعَلَا الْخَمْرَ عَلَى الْمُسْلِمِينَ بَعْدَ أَنْ كَانَ مُبَاحًا لَهُمْ شُرْبُهُ

ibnhibban:5351al-Faḍl b. al-Ḥubāb > Abū al-Walīd > Shuʿbah > Abū Isḥāq al-Sabīʿī > al-Barāʾ b. ʿĀzib

"Some people among the Companions of the Prophet ﷺ died while they had been drinking Khamr. So when it was revealed that it was unlawful, some people among the Companions of the Messenger of Allah ﷺ said: 'How about our companions who died while they were drinking it?' So (the following) Ayah was revealed: Those who believe and do righteous good deeds, there is no sin on them for what they ate (5:93)." (Using translation from Tirmidhī 3051)   

ابن حبّان:٥٣٥١أَخْبَرَنَا الْفَضْلُ بْنُ الْحُبَابِ قَالَ حَدَّثَنَا أَبُو الْوَلِيدِ قَالَ حَدَّثَنَا شُعْبَةُ قَالَ أَنْبَأَنَا أَبُو إِسْحَاقَ السَّبِيعِيُّ عَنِ الْبَرَاءِ بْنِ عَازِبٍ قَالَ

«مَاتَ نَاسٌ مِنْ أَصْحَابِ النَّبِيِّ ﷺ وَهُمْ يَشْرَبُونَ الْخَمْرَ فَلَمَّا حُرِّمَتْ قَالَ نَاسٌ مِنْ أَصْحَابِ النَّبِيِّ ﷺ كَيْفَ بِأَصْحَابِنَا مَاتُوا وَهُمْ يَشْرَبُونَهَا؟ فَنَزَلَتْ هَذِهِ الْآيَةُ {لَيْسَ عَلَى الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ جُنَاحٌ فِيمَا طَعِمُوا}»