DIAGNOSIS The battery latch springs in the tool's battery port are worn or broken. The plastic latch levers can also crack.
FIX Inspect the two black plastic latch levers inside the tool's battery port. If cracked, the battery port assembly needs replacement. If just weak, the internal springs are shot.
IF THAT DIDN'T WORK The slide rails on the battery itself may be worn. Try a different battery. If it clicks in tight, the problem is the battery housing.
HEADS UP A loose connection causes intermittent power and can damage battery and tool terminals. Fix it promptly.