Here James tells us that if we lack wisdom, we need to ask the Lord to give us wisdom. However, we are warned to pray with faith. The topic is wisdom, but we see another principle of prayer in this passage. Do you believe when you pray? We must believe that God can give us the things we pray for that are good and proper according to the Word of God.
What are you saying about God in your heart if you do not believe when you pray? The issue is your understanding of the Lord and who He is! James gives strong rebuke. We see we must pray, pray properly, and pray believing we trusting in God.
Consider: Proverbs 3:5