To let the cat out of the bag

to give away a secret, usually by mistake

my family were organising a surprise birthday party for my father. I didn’t realise he was in the house when I was on the ‘phone to my sister to finalise details and he heard me. I let the cat out of the bag.

The origin of the idiom is not known. There are several suggestions; one is that the “cat” refers to a whip called the “cat o'nine tails", an instrument of punishment once used in the Royal Navy. It may have been stored in a bag and a sailor who revealed the transgressions of another would be "letting the cat out of the bag".
The idiom was referred to in a letter to Martin Luther in 1530.