'Ali bin Rabi'a reported that the first one who was lamented upon in Kufa was Qaraza bin Ka'b. Mughira bin Shu'bah said: I heard the Messenger of Allah (ﷺ) saying: He who is lamented upon would be punished because of the lamentation for him on the Day of Judgment.
´Ali bin Rabi'ah Al-Asadi said:` "A man died among the Ansar named Qarazah bin Ka'b, and he was being wailed over. So Al-Mughirah bin Shu'bah came and ascended the Minbar. He uttered thanks and praise to Allah and said: "As for the gravity of wailing in Islam, indeed I heard the Messenger of Allah saying: 'The one who is wailed over is punished as long as he is being wailed over.'"
Shaykh Dr. Abdur Rahman Freywai
Commentary: 1؎ : To loudly wail over the deceased by enumerating his virtues and excellences is called "niyahah" (wailing). 2؎ : This punishment will be for the person who either instructed his heirs to do so, or whose own practice in life was such, and his family members are wailing over him in imitation of his example.
Source: Sunan al-Tirmidhi – Majlis ‘Ilmi Dar al-Da‘wah, New Delhi Edition, Page: 1000