At the end of this Psalm, David asks God to search for any wickedness in his life. In Psalm 139:23-24 David says, 23 Search me, O God, and know my heart; test me and know my anxious thoughts. 24 See if there is any offensive way in me, and lead me in the way everlasting. David is not challenging God to find him perfect, he is challenging God to identify sin and make it known so he can fix it. Too often we justify our sin and make excuses for the choices we make. If we are honest and open our hearts and minds to God, He will help us.