Jami` at-Tirmidhi, Volume 5, Book 38, Hadith 2642 (DarusSalam) ⓘ
Narrated 'Abdullah bin 'Amr: that the Messenger of Allah said: "Indeed Allah, the Blessed and Exalted, created His creation in darkness, then He cast His Light upon them, so whoever is touched by that light he is guided, and whoever is not, he goes astray. It is for this reason that I say that the pens have dried with Allah's knowledge."
حَدَّثَنَا الْحَسَنُ بْنُ عَرَفَةَ، حَدَّثَنَا إِسْمَاعِيلُ بْنُ عَيَّاشٍ، عَنْ يَحْيَى بْنِ أَبِي عَمْرٍو السَّيْبَانِيِّ، عَنْ عَبْدِ اللَّهِ بْنِ الدَّيْلَمِيِّ، قَالَ سَمِعْتُ عَبْدَ اللَّهِ بْنَ عَمْرٍو، يَقُولُ سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ " إِنَّ اللَّهَ عَزَّ وَجَلَّ خَلَقَ خَلْقَهُ فِي ظُلْمَةٍ فَأَلْقَى عَلَيْهِمْ مِنْ نُورِهِ فَمَنْ أَصَابَهُ مِنْ ذَلِكَ النُّورِ اهْتَدَى وَمَنْ أَخْطَأَهُ ضَلَّ فَلِذَلِكَ أَقُولُ جَفَّ الْقَلَمُ عَلَى عِلْمِ اللَّهِ " . قَالَ أَبُو عِيسَى هَذَا حَدِيثٌ حَسَنٌ .
also referenced under: Hadith 2642 (Reference) & Book 40, Hadith 37 (In-Book)