I think this was my most shameful mistake in my career.
Once when my job was to modify GDB, I also maintained GDB test suite for daily automatic regression check. The test was written in DejaGnu, Expect, and eventually Tcl.
In my opinion, Tcl is an awkward language for writing this much of complex code.
I was frustrated, and decided to rewrite the test framework in Expect and Perl. Because I would do the same work for at least one more year, I thought the work of rewriting the framework pays off in the future. One of my teammate suggested I was wrong just because I was trying to reinvent the wheel. But I was confident about my evaluation of cost and benefit.
My Expect and Perl version of the test framework was done without much trouble, and I started to use it. Because Perl is a lot less awkward, my productivity got higher. Everything was as I planned.
But later I found some functions that I had to add in the framework. And here is what I was wrong: the function was already in the original Tcl version. If I were still using the Tcl version,
it could easily do the job with some tweak of switches. But I had to modify my Perl version to have such switches. This happened every time I needed to add some twist in the tests. Eventually I admitted my mistake and went back to the Tcl version.