On September 9, 1947, in a lab at Harvard University in Cambridge, Massachusetts, a machine called the Mark II started giving wrong answers.
The Mark II was not a computer in the sense you are picturing. No screen, no chips, nothing quiet about it. It was electromechanical, a room-filling assembly of relays: thousands of small switches that physically clacked open and shut to do arithmetic. Running a calculation on it sounded like a room full of typewriters having an argument.
Somewhere inside all that clacking, the math went bad. So the engineers did what you do with a relay machine. They went through it, panel by panel, relay by relay, hunting for the one switch that wasn’t behaving.
They found a moth.
An actual moth, wings and all, wedged between two relay contacts. The contacts couldn’t close. The circuit couldn’t complete. The arithmetic came out wrong because an insect had flown into it.
Nobody needs a theory for how it got in there. A warm machine full of light and heat, a Massachusetts building in September, a decade before anyone thought about sealed rooms and filtered air.
Here is where it stops being an anecdote and becomes history. They pulled the moth out, and then somebody did something wonderfully human. Instead of flicking it off the bench, they taped it into the logbook. Straight onto the page, next to the time-stamped entry. And beside it they wrote:
“First actual case of bug being found.”

That page still exists. The moth is still on it.
For decades the logbook lived at a US Navy facility in Dahlgren, Virginia, in the way such things do, in a drawer somebody opened occasionally to show a visitor. That Dahlgren connection is not a coincidence, by the way: the Mark II was built under Navy contract and went to the proving ground there, so the machine’s paperwork followed the machine.
In 1988 the logbook was transferred to the Smithsonian. It is catalogued at the National Museum of American History as accession number 1994.0191.01, and it goes on public display periodically. Not permanently. If you want to see the world’s most famous dead insect in person, you have to catch it during a run.
Grace Hopper was on the Mark II team at Harvard. And this is where nearly every retelling of this story goes off the rails.
She did not find the moth. She almost certainly did not write the note. The logbook probably wasn’t even hers. Who actually pried the insect out from between those contacts is not reliably known, and at this distance it likely never will be.
What Hopper did was tell the story. She told it in lectures for something like 45 years, to engineers, to students, to Navy audiences, with the timing of somebody who knows precisely where the laugh sits. That is the entire reason you know about it. Popularizing a story is a real contribution and it does not need to be inflated into a discovery.
Now the twist, which is the actual point and which gets lost every single time.
Everyone tells this as the origin of the word. Moth in the machine, therefore glitches are called bugs, therefore fixing them is called debugging. Tidy. Wrong.
Read the note again. “First actual case of bug being found.”
Actual. That one word is carrying the whole joke. You only write “actual” when the non-actual version is already obvious to whoever reads it over your shoulder.
Engineers had been calling faults “bugs” for generations before 1947. Thomas Edison was using the word that way in the 1870s, in his letters, complaining about the small mysterious troubles that crept into a new device and had to be chased out one at a time. By the 1940s it was old shop slang, worn smooth from use, the sort of word nobody bothers explaining to a new hire.
So the logbook entry is not announcing a new term. It is a punchline. What it means is: we have been saying “bug” figuratively since our grandfathers’ day, and today, finally, one turned up for real.
It is the engineering equivalent of muttering that it’s raining cats and dogs, and then a cat lands on your porch.
Which is exactly why they taped it in. Not because they had discovered something. Because it was funny, and because the kind of person who spends a September afternoon inspecting relays one at a time is the kind of person who knows a good bit when it lands in his lap.
A page from a logbook, a dead moth, and one dry line written by somebody whose name we have lost. Nearly eighty years later, it sits in the Smithsonian, and the joke on it is still being explained backwards.







