history
This idiom originates from a Tang Dynasty story about a corrupt official. When a neighboring official was punished for bribery, the corrupt official panicked and wrote: 'You only beat the grass, but the snake underneath is already alarmed.' It became a metaphor for inadvertently warning your target.