Al-Ilmam bi-Ahadith al-Ahkam 439
وَعَن ابْن عَبَّاس رَضِيَ اللَّهُ عَنْهما، قَالَ: " مَاتَ إِنْسَان كَانَ رَسُول الله ﷺ يعودهُ، فَمَاتَ بِاللَّيْلِ ﷺ فدفنوه لَيْلًا، فَلَمَّا أصبح أَخْبرُوهُ، فَقَالَ: مَا منعكم أَن تعلموني؟ قَالُوا: كَانَ اللَّيْل فكرهنا، وَكَانَت ظلمَة أَن يشق عَلَيْك فَأَتَى فَصَلى عَلَيْهِ ". لفظ البُخَارِيّ.
And from Ibn ʿAbbas, may Allah be pleased with them both, who said: "A person whom the Messenger of Allah ﷺ used to visit died. He died at night and they buried him at night. In the morning they told him, and he said: 'What prevented you from letting me know?' They said: 'It was night, and it was dark, and we disliked to trouble you.' So he went and prayed over him." The wording is al-Bukhari's.