Genesis 6:6 is one of the most unsettling verses in the Torah: And it repented the Lord that he had made man on the earth, and it grieved him at his heart. How could the All-Knowing regret? Bereshit Rabbah (chapter 8) offers a startling answer: God did not regret, because God consulted first.
Rabbi Berachiah said: when the Holy One was about to create Adam, He foresaw that both righteous people and wicked people would come forth from him. He reasoned with Himself. "If I create him, the wicked will come. If I do not create him, how shall the righteous come?" What did God do? He set aside from before Him the way of the wicked — He refused to look at it — and then, clothing Himself in the attribute of mercy, He created Adam anyway. That, Rabbi Berachiah said, is the hidden meaning of Psalms 1:6: For the Lord knoweth the way of the righteous, but the way of the ungodly shall perish. The wicked path was lost to God's foreknowledge by design, so that creation could proceed.
But Rabbi Chanina told it differently. He said God consulted the ministering angels: Let us make man in our image, after our likeness (Genesis 1:26). The angels asked back, "What good will this creature be?" God answered: "That the righteous may come forth from him."
And Rabbi Chanina added a quietly devastating line: God told the angels only about the righteous. He said nothing about the wicked. For if He had, the angels would never have consented to the creation of Adam at all.
Human life, the midrash is suggesting, exists because God withheld one side of the ledger. Mercy was the hidden terms of the contract.