If you come into work the next day and cannot read the code you read you wrote the night before.
It’s time for a rewrite.
If you are debugging and lost in the call stack.
It’s time for a rewrite.
If the slightest tinge of fear runs up your spine when someone mentions that library.
It’s time for a rewrite.
It’s not a complicated equation, what is complicated is the amount of work we sometimes have to go through to justify why we need to do the rewrite in the first place.