That usually means that you either have an incompatible headset plugged in (not all headsets have the same pinout), the wires are damaged or are picking up noise from somewhere, or your headphone port is damaged (causing phantom signals or noise to be picked up as commands, as changing volume or triggering the command button on the headset, which triggers Google's Assistant).
Clean the port gently and make sure that your headset is fully inserted. If it keeps failing, try another headset and see if the problem persists. If it doesn't, then the issue is your headset. If it does, then the problem might be your headphone port.