Correct

功败垂成

/ gōng bài chuí chéng /
Strokes

Definition

to fail within sight of success (idiom); last-minute failure/to fall at the last hurdle/snatching defeat from the jaws of victory

Example

Definition

fail on the verge of success; suffer defeat when victory is within reach; fall through when victory/success is in sight