Usually bad maintenance..........
I have seen a lot of times where a maintenance issue creates a problem for the flight crew that is able to be overcome, but...humans being human, they make the wrong choices in trying to deal with it.
Hard to get around that. Even the best pilots have mad mistakes...