Is it OK to complain to God?

Maybe it is.

I noticed in Habakkuk 2:1, Habakkuk says he will stand on the watchtower, to see how God will answer his complaint. Most English translations say "complaint" here, although a few (NASB and King James) say "what I shall answer when I am reproved."
There are several mentions of complaint poured out to God n the Psalms, Psalm 55:2, 64:1, 102 (in the title, before verse 1), 142:2.

But weren't the Israelites punished for complaining to God in the wilderness? Numbers 14:2 says the whole community "grumbled against Moses and Aaron," and in 14:27-30 God says he has heard their grumbling and they will all die in the desert, none of them (except Caleb and Joshua) will enter the promised land. The King James says they "murmured against Moses and Aaron," and my Logos word search says this Hebrew word means "murmuring," and the lexicon defines it as "a complaint uttered in a low and indistinct tone."

So what is the difference? Here's my theory. When you grumble or murmur, you are mostly talkng to yourself, or to your close friends. The Israelites were saying to themselves "this won't end well. We are doomed!"
Habakkuk and the Psalmist don't murmur to themselves, they bring their complaints to God. They maintain relationship with God, while the Israelites were giving up on God.

So presenting complaints to God because you're staying in relationship, admitting what you are feeling to God, is OK. Grumbling or murmuring to yourself out of the attitude that this relationship with God has obviously not worked, and you are getting out as soon as you can, is a lack of faith.

So present your complaints to God. I think God appreciates our honesty. David and Jesus prayed "why have you forsaken me," do we really think we can be more spiritual than they were?

But I don't think we should just complain to God. We're also supposed to thank him, worship him and confess our sins.

Habakkuk's story

A man of God prayed for God to heal the nation. God said he had a plan: things will get a lot worse before they get better. The man cries "how is that a solution?" God says "trust me." Then the man gets a fresh glimpse of God in his majesty, he says "I trust you, whatever you choose to do."

The story step by step:
Habakkuk the prophet cries out to God because the nation of Israel is corrupt, and God is not answering his prayers. "How long must I call for help, but you do not listen. ... the law is paralyzed and justice never prevails. The wicked hem in the righteous."

God answers that he has a plan -- the Babylonians will rise up and conquer Israel. "I am raising up the Babylonians, that ruthless and impetuous people, who sweep across the whole earth to seize dwelling places not their own."

Habakkuk then asks, "You have chosen them to punish us, but why? Why are you silent when the wicked swallow up those more righteous than themselves." I think Habakkuk is thinking "we're bad, but those Babylonians are worse. Why use them to punish us."

God replies to write down the revelation and hang onto it, you may have to wait a long while but it will come true. Justice will come upon those who do evil. The Babylonians will be judged in turn.

Habakkuk then prays for God to show himself. "I have heard of your fame, renew your deeds in our time." Do again the great things we read about that happened in the past.

God then shows himself to Habakkuk in a vision. "His glory covered the heavens and his praise filled the earth. His splendor was like the sunrise; rays flashed from his hand, where his power was hidden." One part sounds like Armageddon. "You came out to deliver your people, to save your anointed one. You crushed the leader of the land of wickedness, you stripped him from head to foot."

Habakkuk, now having seen God's greatness, responds that whatever God chooses  to do is OK.  "I will wait patiently for the day of calamity to come on the nation invading us. Though the fig tree does not bud and there are no grapes on the vines, though the olive crop fails and the fields produce no food, though there are no sheep in the pen and no cattle in the stalls, yet I will rejoice in the LORD, I will be joyful in God my Savior."

Those last words, to rejoice even if everything goes wrong, are sometimes quoted in isolation, as a challenge to be thankful even in hardship. While that is a good principle, I think it short-circuits the point of the story. The point is Habakkuk sought God, and when he saw God, when he understood who God was, he was able to be content even when everything goes wrong. We should seek the same kind of knowledge and experience of God, so that God produces in us the same kind of faith Habakkuk had.