Green’s Dictionary of Slang

cock-up n.

[SE cock, to bend at an angle, but with undertones of cock n.3 (1), on the pattern of fuck-up n. (1), balls-up n.]

[1920s+] (orig. milit.) an error, a blunder.