From Ecclesiastes 7:16,
Do not be overrighteous, neither be overwise— why destroy yourself?
So, why does the Bible say, "don't be too righteous"? Encouraging one to be moderate in their righteousness... Doesn't that seem a bit out of place?
One possible interpretation is that it is warning against legalism - the type of "over righteousness" that the Pharisees were known for. Not exactly a true righteousness, as seen from God's perspective, but a self perceived righteousness derived from a "holier-than-thou" attitude.
The Werner Bible Commentary puts it like:
A bit farther down, in verse 20, it goes on to say:
This is something that the Pharisees did not seem grasp, and righteousness through their own "over righteousness" was something that the Pharisees saw as attainable, or already attained.
One must not treat the whole Bible as a homogenous text, which represents a single point of view. There are different texts, which serve different purposes. The earliest parts are more suitable for children, in that they are clear message tales, where the good people win and the bad people get struck down by God. The later texts are more nuanced adult narratives, which try to mirror how life actually is.
The more secular philosophical text of Ecclesiastes (available in my translation on Wikisource ) is very different than the earliest law-giving texts, or the histories and prophecies. It belongs to the third part of the old testament, called "the writings" by Jews, and along with the Book of Job, the proverbs, and some of the Apocrypha, it is considered a book of wisdom, reflecting a philosophy that was considered important enough to canonize.
Ecclesiastes shows a Greek influence. The writing is recursive and flowing, and contains a greater degree of abstraction than the earliest books. It is believed to have been written in Hellenistic times, around the 2nd-3rd century BC, making it perhaps the very latest contribution to be canonized in the old testament.
The text is interesting in that it is easily heretical at points, and this is one of the major arguments used back then against its canonization. There are several points where you hear what sounds like a redactor. The last verses of the book are an infamous summary, which does not summarize:
The actual content of the book is completely different. This is one of the books of the Bible that is actually worth reading end to end.
Ecclesiastes is a free-thinking catalog of despair, at the meaninglessness of life and the unreality of the world. It is a philosophy of misery, similar to the Hindu concept of Maya, or world-illusion. We are all trapped in Maya, "Havel" in Koheleth's words, or "Vanity" in King James, "mirage" in Wikipedia, "vapor-wisp" in the most literal reading of the Hebrew. This is meaninglessness that is a consequence of the slightness of our world, its ephemerality, and our actions, we are all headed to the grave, the wise along with the foolish, and nothing that we do is particularly meaningful when considered on, say, geological time. Everything repeats in an eternal cycle, nothing is truly new. Wicked people prosper, righteous people are struck down, and there are injustices that cannot be fixed.
This idea, the futility, leads Koheleth to all sorts of despair and searching. He tries out all sorts of things, building, and destroying, study, and partying, piety, and sin. He concludes that life is finite, and of no consequence or meaning, that there is no afterlife, so we should take some pleasure out of our limited time, be mostly virtuous, and a little sinful, and try to enjoy ourselves as long as we are here.
This type of philosophy is completely out of place in the Bible, and this book therefore has many quotes which can be construed as contradicting the rest of the Bible. Koheleth tells you to enjoy life, be happy on Earth, and forget about heavenly rewards (3:20):
He explicitly denies the afterlife later: (Ecc. 9:10)
He tells you to not be too virtuous (7:16):
He tells you that righteousness is not rewarded (8:14):
This text is not representative of Jewish or Christian theology. It is not representative of what we would call modern secular philosophy either. It might have a root in Hindu or Buddhist traditions of Maya or Earthly suffering, but even then, it is delivered in a different ideosyncratic way, as the personal story of a wealthy scholar. The Bible would be a lot more consistent without it.
So why is this text canonized? Perhaps the last verses will make it clear:
If this writing isn't divinely inspired, then nothing is.