功败垂成 (功敗垂成) gōng bài chuí chéng

gōng bài chuí chéng set phrase to fail within sight of success; last-minute failure/to fall at the last hurdle/snatching defeat from the jaws of victory
Domain: Idiom 成语
Notes: (CC-CEDICT '功敗垂成'; Guoyu '功敗垂成')