Peace be upon you. There is a fundamental principle that we must believe in: anything that is established with certainty and necessity must be interpreted if there is a text that appears to contradict it. The intellect that God created in humans to guide them is the same intellect that confirms God's existence, that God is not a physical body, and that the Quran is from God. Therefore, how can we interpret the verse 'The hand of God is above their hands' as referring to a physical hand?
Similarly, regarding infallibility, if reason confirms the infallibility of the prophets (peace be upon them) and we encounter a text that seemingly indicates a prophet acted contrary to this infallibility, we must interpret that text.
The scope of what reason establishes regarding infallibility is narrow; it judges that a prophet does not commit sins or errors in conveying the message.
Adam (peace be upon him) is undoubtedly a prophet, and reason has judged their infallibility as supported by authentic texts. Therefore, we must interpret any indication that Adam's actions contradicted infallibility by saying, for example, that Adam disobeyed by neglecting a non-obligatory command, which was merely advisory. God advised him that eating from that tree would lead to the loss of the benefits of Paradise, such as freedom from hunger, nakedness, and thirst. Disobeying an advisory command is termed disobedience in the Quran, but it is not the type of disobedience that undermines human dignity or infallibility.
In the case of Moses (peace be upon him) with the servant whom God granted knowledge, he (peace be upon him) accepted God's wisdom. There is nothing in the verses that contradicts this; however, he was surprised by that type of judgment, which was based on knowledge of the unseen. Moses (peace be upon him) judged based on appearances, and he was astonished by what occurred with the servant whenever an event took place, all of which were striking. This astonishment does not undermine infallibility, as he accepted everything the servant said and did before the true nature of matters was revealed to him.
May you be successful in all good.