1 : a social or diplomatic blunder
2 : a noticeable mistake
The gaffe that we apply to mistakes and blunders of various kinds was borrowed from French but likely has its origins in the argot of sailors. Herman Melville introduces the probable linguistic ancestor of the modern word—gaff—in this somewhat stomach-churning account of the goings-on in a whaling ship's blubber room:
But to learn all about these recondite matters, your best way is at once to descend into the blubber-room, and have a long talk with its inmates. This place has previously been mentioned as the receptacle for the blanket-pieces, when stript and hoisted from the whale. When the proper time arrives for cutting up its contents, this apartment is a scene of terror to all tyros, especially by night. On one side, lit by a dull lantern, a space has been left clear for the workmen. They generally go in pairs,—a pike-and-gaff-man and a spade-man. The whaling-pike is similar to a frigate's boarding-weapon of the same name. The gaff is something like a boat-hook. With his gaff, the gaffman hooks on to a sheet of blubber, and strives to hold it from slipping, as the ship pitches and lurches about. Meanwhile, the spade-man stands on the sheet itself, perpendicularly chopping it into the portable horse-pieces. This spade is sharp as hone can make it; the spademan's feet are shoeless; the thing he stands on will sometimes irresistibly slide away from him, like a sledge. If he cuts off one of his own toes, or one of his assistants', would you be very much astonished? Toes are scarce among veteran blubber-room men.
We did warn you.
From the blubber room, gaff moved on to other job sites, including those frequented by loggers and butchers. It also enjoyed less messy nautical applications having to do with sails and pennants. We won't blame the professionals, but somehow along the way, gaff also developed meanings synonymous with hoax and fraud, as well as gimmick and trick. It also came to be used to refer to something painful or difficult to bear, and to persistent criticism or teasing. (Those latter developments we can imagine taking root in that blubber room, but we won't venture back there again.) Gaff at this point was centuries old, but it appears that our modern word gaffe dates only the early 20th century, when it was borrowed from French where it had both the "boat hook" meaning and an informal meaning of "blunder."