TABARANI 4477:
from Rāfiʿ b. ʿUmayr —
[Machine] I heard the Messenger of Allah ﷺ saying: Allah said to Dawud ﷺ , "Build a house for Me on earth." So Dawud built a house for himself before building the house he was commanded to. Then Allah inspired to him, "O Dawud, you have established your house before My house." Dawud said, "O Lord, is this what You have decreed for the one who has authority and takes possession, and then starts building the mosque?" When the walls were completed, two-thirds of the structure collapsed. He complained to Allah about it, and Allah revealed to him, "It is not appropriate for you to build a house for Me because of the bloodshed that has occurred at your hands." Dawud asked, "O Lord, was it not in accordance with Your desires and love?" Allah replied, "Yes, but they are My servants and I am more merciful towards them. This has saddened you, but fear not, I will fulfill the construction through the hands of your son Sulaiman." So, when Dawud died, Sulaiman took charge of the construction. When it was completed, he gathered the people for prayers and sacrificed animals. Allah then revealed to him, "I see the joy of my house being built, ask me and I will grant you three characteristics: a ruling that coincides with your ruling, sovereignty that no one after you can possess, and whoever enters this house desiring only to pray in it will have their sins forgiven as on the day they were born." The Messenger of Allah ﷺ said, "As for two of them, he was granted them, and I hope that he was also granted the third."
الطبراني ٤٤٧٧:
عن رافع بن عمير —
سَمِعْتُ رَسُولَ اللهِ ﷺ يَقُولُ قَالَ اللهُ ﷻ لِدَاوُدَ عَلَيْهِ السَّلَامُ ابْنِ لِي بَيْتًا فِي الْأَرْضِ فبَنَى دَاوُدُ بَيْتًا لِنَفْسِهِ قَبْلَ الْبَيْتِ الَّذِي أُمِرَ بِهِ فَأَوْحَى الله ﷻ إِلَيْهِ يَا دَاوُدُ نَصَبْتَ بَيْتِكَ قَبْلَ بَيْتِي قَالَ يَا رَبِّ هَكَذَا قُلْتَ فِيمَا قَضَيْتَ مَنْ مَلَكَ اسْتَأْثَرَ ثُمَّ أَخَذَ فِي بِنَاءِ الْمَسْجِدِ فَلَمَّا تَمَّ السُّوَرُ سَقَطَ ثُلُثَاهُ فَشَكَا ذَلِكَ إِلَى اللهِ ﷻ فَأَوْحَى الله ﷻ إِلَيْهِ أَنَّهُ لَا يَصْلُحُ أَنْ تَبْنِيَ لِي بَيْتًا قَالَ أَيْ رَبِّ وَلِمَ؟ قَالَ لِمَا جَرَتْ عَلَى يَدَيْكَ مِنَ الدِّمَاءِ قَالَ أَيْ رَبِّ أَوَ لَمْ يَكُنْ فِي هَوَاكِ وَمَحَبَّتِكَ؟ قَالَ بَلَى وَلَكِنَّهُمْ عِبَادِي وَأَنَا أَرْحَمُهُمْ فَشَقَّ ذَلِكَ عَلَيْهِ فَأَوْحَى اللهُ إِلَيْهِ لَا تَحْزَنْ فَإِنِّي سَأَقْضِي بِنَاءَهُ عَلَى يَدَيِّ ابْنِكَ سُلَيْمَانَ فَلَمَّا مَاتَ دَاوُدُ أَخَذَ سُلَيْمَانُ فِي بِنَائِهِ فَلَمَّا تَمَّ قَرَّبَ الْقَرَابِينَ وَذَبَحَ الذَّبَائِحَ وَجَمَعَ بَنِي إِسْرَائِيلَ فَأَوْحَى الله ﷻ إِلَيْهِ قَدْ أَرَى سُرُورًا بِبُنْيانِ بَيْتِي فَسَلْنِي أُعْطِكَ قَالَ أَسْأَلُكَ ثَلَاثَ خِصَالٍ حُكْمًا يُصَادِفُ حُكْمَكَ وَمُلْكًا لَا يَنْبَغِي لِأَحَدٍ مِنْ بَعْدِي وَمَنْ أَتَى هَذَا الْبَيْتَ لَا يُرِيدُ إِلَّا الصَّلَاةَ فِيهِ خَرَجَ مِنْ ذُنُوبِهِ كَيَوْمِ وَلَدَتْهُ أُمُّهُ قَالَ رَسُولُ اللهِ ﷺ «أَمَّا اثْنَتَيْنِ فَقَدْ أُعْطِيَهُمَا وَأَنَا أَرْجُو أنْ يَكُونَ قَدْ أُعْطِيَ الثَّالِثَةَ»
hadithunlocked.com