Some argue that the Bible is contradictory concerning whether God is omniscient. The argument is that the Bible teaches that God is omniscient (Hebrews 4:13), but God did not know where Adam was in Genesis 3:9. However, this alleged contradiction has a very easy answer.
8 And they heard the sound of the Lord God walking in the garden in the cool of the day, and the man and his wife hid themselves from the presence of the Lord God among the trees of the garden. 9 But ”’the Lord God called to the man and said to him, “Where are you?””’ 10 And he said, “I heard the sound of you in the garden, and I was afraid, because I was naked, and I hid myself.”Genesis 3:8-10
And no creature is hidden from his sight, but all are naked and exposed to the eyes of him to whom we must give account.Hebrews 4:13
There is more than one reason why someone could ask a question. One reason is that the person does not know the answer, but another reason could be to teach a lesson. The second reason is why God asked Adam, “Where are you?”, not because God did not know the answer to the question.
Adam had just disobeyed and sinned against God by eating the forbidden fruit. God asked Adam, “Where are you?”, to cause Adam to reflect upon what he had just done and recognize that he had rebelled against God.
Essentially, God was also asking Adam, “Where are you in relationship to me spiritually?”
There are some foundational principles that apply to all alleged and apparent contradictions in the Bible. To read more, see Bible Difficulties: Foundational Principles.
To read more answers to alleged and apparent contradictions in the Bible, see “Contradictions” in the Bible Answered.
These books are also excellent resources: