Many animals laugh when tickled, it provides feedback to the other member of the social group strengthening bonds. It is also play behavior, the animal will try to resist tickling of sensitive parts of their body.
Chimpanzees laugh when they hear others laughing so apparently in apes the behavior became connected with other social stimuli.
Human verbal humor is a bit of a mystery, a valid theory would need to discern between instinctive and learned responses and provide a feasible explanation for each step of the proposed mechanism, as opposed to saying something like "debugging is useful and we laugh when we debug something so we evolved to enjoy debugging just because".