borrowed from French gaffe, going back to Middle French, borrowed from Old Occitan gaf, probably derivative of gafar "to seize," of obscure origin
Note: Middle English gaffe, occurring in the early 14th-century "Kildare Poems" (British Library MS Harley 913) and glossed "iron hook" in the Middle English Dictionary, is of uncertain relation to the modern word. It predates attestations of the word in French.