Where 'bug' and 'debugging' really come from
Grace Hopper's 1947 moth in the Harvard Mark II is real, and it is in the Smithsonian. But the word "bug" for an engineering fault is decades older — Edison used it in 1878 — which is exactly why the logbook entry is a joke.
AI-assisted postDrafted with help from Claude, edited and fact-checked by Mart. See transparency policy →
The actual logbook page, moth still taped in. U.S. Naval History and Heritage Command photo NH 96566-KN — a U.S. federal work, public domain.
The famous story is that the word bug comes from a moth found inside the Harvard Mark II in 1947, taped into the logbook with the note "first actual case of bug being found." The story is true in every checkable detail: the moth was real, the logbook entry is real, and the logbook is in the Smithsonian today. What the story gets backwards is the etymology. The word bug meaning an engineering fault was already decades old in 1947 — Thomas Edison used it in 1878 — which is the entire reason the logbook entry is funny. The operators were not coining a term. They were making a pun that only lands if everyone in the room already used bug to mean a defect. The moth did not name the bug. The bug named the moth.
What the popular story claims
The version that circulates goes roughly like this: on 9 September 1947, the operators of the Harvard Mark II relay computer found their machine malfunctioning, traced the fault to a moth caught in the contacts of a relay, removed it, taped it into the logbook, and wrote "first actual case of bug being found" — and that is why we call software defects bugs. Grace Hopper, the pioneering computer scientist who was associated with the Mark II, is usually credited as the source.
It is a great story, and it has the rare virtue of being mostly true. There really was a moth, on roughly that date, in the Harvard Mark II, taped into a real logbook with that exact phrase. The problem is only the causal claim at the end — that this incident is the origin of the word. That part is wrong, and demonstrably so.
Edison's bugs, 1878
The word bug for a fault or defect in a machine predates the moth by nearly seventy years. The clearest early instance is Thomas Edison. In an 1878 letter to Tivadar Puskás, an associate, Edison described his working method and the troubles that followed the first flush of an idea: "The first step is an intuition, and comes with a burst, then difficulties arise — this thing gives out and [it is] then that 'Bugs' — as such little faults and difficulties are called — show themselves." The crucial phrase is as such little faults and difficulties are called. Edison is not inventing the word. He is using a term he expects his correspondent to recognise, and explaining it the way you explain established jargon, not a coinage.
The Oxford English Dictionary records this sense of bug — a defect or fault in a machine — and its early citations bear Edison out. The OED's supporting quotations include an 1889 Pall Mall Gazette item that explicitly attributes the usage to Edison's work on the phonograph, reporting that he had been up two nights chasing "a bug" in the device. By 1934 the meaning had made it into Webster's dictionary. So the term was in print, attributed to a famous engineer, and dictionary-recognised, all decades before anyone went looking inside a relay computer.
"Debugging" was already engineering slang
The verb debug has its own pre-1947 paper trail. The lexicographer Fred Shapiro has pointed out that debug appears in a 1945 issue of the Journal of the Royal Aeronautical Society, used in an aviation-engineering context — meaning that even the de- prefixed form was in technical writing two years before the moth. Shapiro's reasonable inference is that the printed 1945 usage was "probably preceded by several years of oral use in engineering slang." Aircraft engineers were debugging engines before computer operators were debugging programs.
This matters because debugging is now so thoroughly a software word that it feels native to computing. It is not. Both bug and debug arrived in computing pre-loaded from the older world of mechanical and electrical engineering, where a bug was any small persistent fault and debugging was the work of hunting one down. Software simply inherited the vocabulary of the engineers who built the first machines, the same way it inherited the daemon and a great deal of Unix terminology from the systems and people that came before it.
Older than Edison: the frightening sense
If Edison is the earliest clear engineering use, the word itself runs much deeper, and the deeper history quietly supports the engineering meaning. The sense of bug meaning insect is itself surprisingly recent in English — it first appears in the 1620s, originally in reference to bedbugs, and its further origin is uncertain. Etymologists suspect it was influenced by an older and now-obsolete word: Middle English bugge, attested in the late 14th century, meaning something frightening — a scarecrow, a specter, a hobgoblin. That bugge survives today only in fossils like bugbear (1570s) and bugaboo, and is probably related to Scottish bogill (goblin) and the dialectal bogey.
So before bug meant a beetle, it meant a thing that scares you in the dark — an unseen source of trouble. That older connotation arguably never fully left. When a 19th-century engineer called a persistent, hard-to-locate fault a bug, the word already carried a faint sense of a small malevolent gremlin hiding in the works, causing trouble you cannot quite see. The figurative engineering meaning is a comfortable extension of a word that started out naming exactly that: an obscure source of difficulty. The insect sense and the gremlin sense both feed the engineering sense, which is part of why bug felt natural enough to engineers that nobody bothered to record who coined it.
The moth, and why the entry is a joke
So what actually happened in 1947? The operators of the Mark II — the team Grace Hopper worked with, at what is now part of the Naval surface-warfare lineage — found a moth lodged in the electromechanical relays of the machine. Relays are physical switches; an insect wedged between the contacts genuinely can stop one from closing and cause a malfunction. They removed it, taped it into the logbook, and wrote: "First actual case of bug being found."
Read that sentence with the etymology in hand and the joke snaps into focus. The word actual is doing all the work. These were people who used bug every day to mean a fault — an abstract, figurative fault. When they found a literal insect causing a literal fault, the humour was in the collision of the two meanings: for once, the bug was an actual bug. You do not write "first actual case of bug being found" unless your readers already use bug in the non-actual, figurative sense. The note is a pun, and a pun requires the prior meaning to exist. The logbook entry is not evidence that the moth coined the term. It is evidence that the term was already so routine that finding a real one was worth a laugh.
Who actually found it, and where it is now
Two smaller corrections to the popular telling. First, the moth was almost certainly not found by Grace Hopper personally. The Smithsonian, which holds the artifact, notes that the logbook was probably not Hopper's; Hopper's role was in telling the story for decades afterward, in lectures and interviews, which is how it became attached to her name and how it spread. She popularised it; she did not necessarily live it. The actual discoverer was one of the operators on the team, unnamed in most accounts.
Second, the artifact survives. The logbook page with the moth still taped to it is held by the Smithsonian Institution's National Museum of American History. It is a genuine relic of early computing — just not the relic of first naming that the legend claims. It is a relic of a good joke, made by people who knew the word already.
Why the wrong version won
The myth persists for the same reasons most origin myths do: it has a clean object (a moth you can see in a museum), a famous protagonist (Grace Hopper), a precise date, and a satisfying punchline that doubles as an explanation. The true version is messier — a word that drifted in from 19th-century engineering slang through Edison's notebooks and aviation journals, with no single coinage moment and no photogenic artifact. Etymology rarely has a hero or a clean origin date; it has decades of oral usage that only occasionally leaves a paper trail.
The honest summary is the one the JSTOR and Computer History Museum accounts both land on: the moth incident is real and wonderful and worth preserving, but it documents the word rather than originates it. The bug existed long before the moth. The moth just gave a roomful of engineers a chance to write down a pun that has outlived all of them.
A short close
The word bug for an engineering fault goes back at least to Edison's 1878 letters and was dictionary-recognised by the 1930s; debug was in aviation-engineering print by 1945. The 1947 Harvard Mark II moth is entirely real, and the logbook is in the Smithsonian — but the entry that made it famous, "first actual case of bug being found," is a joke that only works because everyone already used bug to mean a defect. The moth did not name the bug. The bug, already old by 1947, named the moth.
Read next


