The Messenger of Allah ﷺ said, "When Allah wills to create a soul, the angel of the wombs says, 'My Lord, male or female?' and Allah decrees His command to him. Then he says, 'My Lord, wretched or blessed?' and Allah decrees His command to him. Then it is written between his eyes everything he will encounter, even the stumble he will suffer."
قال رسول الله ﷺ: إذا أراد الله عز وجل أن يخلق النسمة، قال ملك الأرحام فيها: يا رب أذكر أم أنثى؟ فيقضي الله إليه أمره، ثم يقول: يا رب أشقي أم سعيد؟ فيقضي الله إليه أمره، ثم يكتب بين عينيه ما هو لاق حتى النكبة ينكبها.
No references are available.
Abdullah bin Wahb related it in Kitab Qadar (30), and by his route Firyabi in Qadar (142), Ibn Hibban in his Sahih (6178), and Lalikai in Itiqad (1051), all of them from the hadith of Yunus, from Zuhri, that Abdul-Rahman bin Hunaydah told him, that Abdullah bin Umar said (then he mentioned it). Its chain is sahih.As for the statement of Bazzar in Kashf Astar (2149), "We do not know of anyone who related it from Zuhri, from Salim, from his father, except Salih (Ibn Abu Akhdar)," this is challenged by the narration of Yunus from Zuhri, as it was also related by a group of narrators. Ibn Abu Asim brought it out in Sunnah (182, 183, 184), and others gave it as stopped, but those who related it as raised are many and they are trustworthy.Haythami said in Majma (7/193), "Abu Yaala and Bazzar related it, and the men of Abu Yaala are the men of the Sahih."