When a defect arises from poor workmanship, where does liability usually lie?

In this case, liability often rests with the contractor.