Why is a computer error called a bug? It wasn't the moth
Everyone says an insect trapped in a 1947 computer gave the bug its name. The insect was real, but the word was already over 70 years old. Thomas Edison used it.

Your banking app freezes just as you’re paying a bill. You call, and the agent explains: “it was a bug in the system”. You get it right away, even though a bug is, literally, an insect.
Why does a computer error have the name of a creature? The internet usually answers with a great story: a moth, a giant computer and a US Navy admiral. It’s true, but only in part. The word is much older than the insect.
The moth that became famous
The scene took place at Harvard, with the Mark II, a giant calculator created by Howard Aiken. At 3:45 p.m. on a test day, the team found a moth trapped between the contacts of relay 70, on panel F.
A relay is a switch operated by an electromagnet (a magnet that turns on and off with electricity). The Mark II did its calculations with these switches opening and closing, parts that actually moved. A creature in the wrong place was enough to get in the way.
The team removed the insect, taped it into the machine’s logbook and wrote next to it: “First actual case of bug being found”. The moth is still there, on the page.
Even the date has two versions. The Smithsonian says 1947. The photo caption in the US Navy’s collection says September 9, 1945, and Grace Hopper herself told the story as happening in 1945. But Computerworld points out that the Mark II only went into operation in the summer of 1947, so I’m going with September 9, 1947, the year the museum uses.
Notice the joke
Now read the note again: first actual case. That’s only funny if everyone there already called a defect a bug. It was like finding a real rat inside the mouse.
The team didn’t invent anything. They just made the joke the moment called for. And that’s the part of the story that almost never gets told: the word had been around for a long time.
Edison’s telegraph
In 1873, Thomas Edison was trying to send four messages over a single telegraph wire. An annoying problem appeared: when the current changed direction, a false glitch showed up in the signal, scrambling the Morse code.
Edison created a part to isolate that glitch, a “bug trap”. According to the historians who wrote about it in IEEE Spectrum, the electrical engineers’ magazine, the word appears in his notebooks in July 1876.
In March 1878, he joked in a letter to the president of Western Union, the telegraph giant, that he had found a “bug” in the device. In November of that year, he wrote to Theodore Puskas that this was what he called the little faults that show up after the initial idea of an invention.
After that, the term went global. In 1889, a British reporter wrote that Edison had spent the night hunting a “bug” in his phonograph. In 1892, an electrical dictionary already included the definition. And by 1934 the word was in Webster’s dictionary with that meaning of a defect.
And why an insect?
Here, nobody knows for sure. What the IEEE Spectrum authors point out is that Edison was largely responsible for spreading the term, but the root is older: it comes from Welsh, Scottish, German and Middle English words for goblins and ghosts. A bug, in that sense, is the bogeyman hiding in the machine.
It fits. Anyone who has fought with a system knows that sometimes it really does feel like someone in there is messing with you.
What about Grace Hopper?
Many people say she was the one who found the moth and coined the word. Grace Hopper deserves all the applause, but for other reasons. With a PhD in mathematics from Yale, she joined the Navy reserve in 1943 and went to work with Aiken at Harvard. In 1952, she created A-0, one of the first compilers, programs that translate instructions into the machine’s language. She later helped create COBOL, a programming language. She retired from the Navy as a rear admiral, at 79.
In the moth story, she was part of the team, but the Smithsonian notes that the logbook probably wasn’t hers. What she did was tell the story really well, and that’s why it became famous.
What was left
Even the verb debug predates the moth’s fame. It shows up in a 1945 aeronautics journal, and researcher Fred Shapiro believes it was already engineering slang before that.
The first generation of programmers quickly understood the size of the problem. In 1949, at the University of Cambridge, Maurice Wilkes realized he would spend a good part of his life hunting errors in his own programs. I started programming when I was 11 and I can confirm: he was right. That goes for me and for everyone who writes code.
That’s why the millennium bug has that name, and that’s why phone updates promise “bug fixes”. It’s jargon from the telegraph era that survived everything. Computers lost their relays, moths lost their jobs, and the defect nobody saw coming keeps working as usual.


