Anas bin Malik reported,

The Prophet ﷺ entered a date-palm grove belonging to Banu Najjar and heard a sound that startled him. He asked, "Whose graves are these?"They said, "Prophet of Allah, these are people who died in the days of ignorance."He said, "Seek refuge with Allah from the torment of the grave, the torment of the Fire, and the trial of the Dajjal."They asked, "What is that, Messenger of Allah?"He said, "This community will be tested in their graves. When a believer is laid in his grave, an angel comes to him and asks, 'What did you worship?' If Allah has guided him, he answers, 'I worshipped Allah.' He is then asked, 'What did you used to say about this man?' He replies, 'He is the servant of Allah and His Messenger.' He is asked nothing further. He is then taken to a house that was reserved for him in the Fire, and it is said to him, 'This was your house in the Fire, but Allah protected you and showed you mercy and replaced it with a house in the Garden.' He says, 'Let me go and give my family the good news,' but he is told, 'Stay where you are.'As for the disbeliever, when he is laid in his grave, an angel comes to him and asks, 'What did you used to say about this man?' He replies, 'I used to say what the people said.' He is then struck with an iron hammer between his ears and lets out a cry that every creature hears except humans and jinn."

Azami 3842

Sahih

عن أنس بن مالك

أن النبي ﷺ دخل نخلا لبني النجار، فسمع صوتا ففزع، فقال: من أصحاب هذه القبور؟ قالوا: يا نبي الله، ناس ماتوا في الجاهلية، قال: تعوذوا بالله من عذاب القبر، وعذاب النار، وفتنة الدجال قالوا: وما ذاك يا رسول الله؟ قال: إن هذه الأمة تبتلى في قبورها، فإن المؤمن إذا وضع في قبره، أتاه ملك فسأله: ما كنت تعبد؟ فإن الله هداه قال: كنت أعبد الله، فيقال له: ما كنت تقول في هذا الرجل؟ قال: فيقول: هو عبد الله ورسوله، قال: فما يسأل عن شيء غيرها، فينطلق به إلى بيت كان له في النار، فيقال له: هذا بيتك كان في النار، ولكن الله عصمك ورحمك، فأبدلك به بيتا في الجنة، فيقول: دعوني حتى أذهب فأبشر أهلي، فيقال له: اسكن. وإن الكافر إذا وضع في قبره، أتاه ملك فيقول له: ما كنت تقول في هذا الرجل؟ فيقول: كنت أقول ما يقول الناس، فيض به بمطراق من حديد بين أذنيه، فيصيح صيحة فيسمعها الخلق غير الثقلين.

الأعظمي 3842صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Funerals
Chapter
Conditions of the deceased in the grave
Section
People of the Jahiliyyah being punished in their graves
Numbering
Jami al-Kamil 3842 (2nd edition)
Azami 3842