My take / 2 cents worth:
~ Ok. So the context of James is that of severe persecution. Persecution often reveals the true metal of a person. In particular if they are going to stick with God or not. James is dealing with people who waffle back and forth between the goodies that they can get from being in church and the conveniences and even pleasures that they can find in the world. They have one foot in the world and one in the church.
~ So these folks may be praying for wisdom or whatever else, but they also have doubts. These are not doubts in God’s character. These are not necessarily doubts as to whether God can and will act. These are not so much doubts as to whether God will really give them that goody or not.* They are more so doubts that if I get this goody from God, what will that mean in terms of what I will have to give up or lose in the world.
~ Its is like they see that some X is a good to be had and desired. So they pray for it. However yet still while they pray for it, they also on some level don’t want it. Why? Because of the call of the world. So they go back and forth. They doubt whether they really want it or not. What they would really like is to have their cake and eat it also, but that simply cannot be. So they between like waves tossed and blown by the wind. Its a back and forth between two worlds.
*There are ways in which doubt can be valid.
(*Note to self: I think commentator Robert Gundry misses the boat on this issue. Research what he said.)