Koheleth 7:20 reads 'Ki Adam Ain Tzadik' "For there is not a righteous man (upon the earth who has not sinned) The word used for sin, 'yecheteh', also means to miss. The Midrash expounds that for example, righteous administrators of charity might "miss" by being unable to differentiate between the deserving and the undeserving, since they cannot peer into other peoples' hearts.
In the Talmud, Sanhedrin 101a, a story is related. Rabbi Eliezer became ill. He told them that G-d has afflicted him and must be annoyed with him. The students wept except for Rabbi Akiva. The other students asked Rabbi Akiva why he was smiling. Rabbi Akiva came back and said, "Why do you weep?" They said that Rabbi Eliezer was like a scroll of Torah, and he is in jeopardy.
"This is why I rejoice," answered Rabbi Akiva. "When I saw that in our teacher's house the wine never turnes sour, the flax never was beaten, the oil never lost fragrance, his honey never turned rancid. I thought, G-d forbid that our master has already received his reward in this world and nothing was left for the next. Now that I see him in pain, I rejoice."
Rabbi Eliezer asked Rabbi Akiva if he neglected some Torah precept. Rabbi Akiva said, "You our master have taught us the sentence, in Koheleth 7:20 - "There is no righteous man on earth who does good and sins not."
- Adapted from Rabbi I. Broch - Koheleth pg 159 Feldheim