If any of you is lacking in wisdom, ask God, who gives to all generously and ungrudgingly, and it will be given you. But ask in faith, never doubting, for the one who doubts is like a wave of the sea, driven and tossed by the wind; for the doubter, being double-minded and unstable in every way, must not expect to receive anything from the Lord.
God does not despise the one who struggles with doubt. The classic example of Thomas the doubter comes to mind. There is a gentle rebuke in our Lord’s dealing with him, but the Lord did not reject him. Actually the raising of doubt can be an expression of faith. We see it throughout Scripture, Job being one prime example. Job along with many psalmists questions God, raises concerns, in essence they are honest to God.
What James is talking about here is fundamentally different. In the context it’s referring to doublemindedness, no longer really grappling with God, or taking God at God’s word. According to James, it isn’t necessarily that the doubter isn’t praying. But evidently it’s either an empty religious exercise, or becomes that since the one praying is not believing God will come through, not trusting God. It comes across to me as a kind of half hearted prayer in contrast to the healthy doubter who is fully engaged in their wrestling with God.
What I believe we can be assured of is that God will honor our sincere attempt to pray as James (and our Lord in the gospels) tells us to here. It’s not like we have to be perfect, though God can give us a certain faith during such times. We seek to be fully committed to God, open to God’s correction along the way. God will help us to grow in faith and offer the prayer of faith, giving us the needed wisdom we’re asking for, or whatever else we may request in God’s will. In and through Jesus.