I heard the Messenger of Allah ﷺ say, "Allah created His creation in darkness, then cast upon them some of His light. Whoever was struck by that light was guided, and whoever it missed went astray. That is why I say the pen has dried upon Allah's knowledge."
حدثنا الحسن بن عرفة حدثنا إسمعيل بن عياش عن يحيى بن أبي عمرو السيباني عن عبد الله بن الديلمي قال سمعت
سمعت رسول الله ﷺ يقول إن الله عز وجل خلق خلقه في ظلمة فألقى عليهم من نوره فمن أصابه من ذلك النور اهتدى ومن أخطأه ضل فلذلك أقول جف القلم على علم الله
[Sahih] Ismail bin Ayyash was corroborated by Uzai, in Hakim 1/30, who graded it sahih and Dhahabi agreed with him. Ahmad also narrated it in 2/176 from the hadith of Abdullah bin Daylami, and the hadith has multiple routes in Ibn Hibban, no. 1812, and Hakim and others. Mizzi did not mention this hadith in Tuhfat Ashraf.