Why We Call It a 'Bug': Grace Hopper and the Moth
The 1947 Harvard Mark II moth is real and taped into a logbook — but 'bug' was already engineering slang decades before. Here's the honest story.
Every developer says it a hundred times a week: “there’s a bug,” “let me debug this.” The word feels native to computing. But the most famous origin story — a moth, a relay, and a logbook — is both completely true and almost completely misunderstood.
The Moth in the Mark II
In September 1947, a team operating the Harvard Mark II — an electromechanical relay computer — traced a malfunction to an actual insect. A moth had become trapped in one of the machine’s relays, physically interfering with its operation. The operators removed it and taped the moth into the project logbook, writing beside it: “First actual case of bug being found.”
That logbook page survives. It is one of the most reproduced artifacts in computing history, and the incident is genuine — not a fable invented later. Grace Hopper, a pioneering computer scientist who worked on the Harvard machines, is closely associated with the story and loved to retell it, which is why her name is attached to it. The moth itself is preserved at the Smithsonian’s National Museum of American History.
So far, so good. The trap is in what people conclude from it.
The Word Was Already Old
The common claim is that this moth gave us the word “bug.” It did not. The logbook entry is funny precisely because the team already used the word — “bug” was established jargon for a technical fault long before 1947. That is the whole joke. Writing “first actual case of bug being found” only lands as humor if everyone reading it already understands “bug” to mean a defect. The novelty was that, for once, the bug was a literal insect.
The slang is considerably older than computing. Thomas Edison used “bug” to describe faults and glitches in his inventions back in the 1870s; surviving letters show him complaining about working through the “bugs” in a design. By the early twentieth century, “bug” was common in engineering and telegraphy for an unexplained fault. The 1947 operators inherited that vocabulary; they didn’t create it.
So the honest version is this: the moth is a wonderful, well-documented coincidence that gave a piece of existing slang a perfect physical illustration. It popularized and immortalized the term in computing folklore. It did not coin it.
What a Bug Means Today
A software bug is a defect in a program that causes it to behave incorrectly — producing wrong output, crashing, hanging, corrupting data, or otherwise deviating from what was intended. Bugs are almost always human errors in logic, design, or assumptions, encoded into source code and then faithfully executed by a machine that has no idea anything is wrong.
“Debugging” is simply the work of finding and removing those defects. A typical loop looks like:
1. Reproduce the bug reliably
2. Narrow down where it happens (logging, breakpoints, bisecting)
3. Form a hypothesis about the cause
4. Fix it and verify the symptom is gone
5. Check you didn't break something else
Modern bugs come in flavors worth naming: a crash halts the program; a logic error runs cleanly but produces wrong results; a race condition depends on unlucky timing between concurrent operations; a regression is a bug reintroduced into something that previously worked. The Mark II’s moth was, in a sense, a hardware fault — but the word it illustrated has been overwhelmingly claimed by software, where most defects now live.
The lineage is satisfying to hold in your head: Edison cursing the bugs in a telegraph, a moth pressed into a Harvard logbook, and you, today, staring at a stack trace muttering the same word. It’s the same complaint, carried across a century and a half.
FAQ
FAQ
Did Grace Hopper invent the term 'bug'?
Is the moth story actually true, or a myth?
Where does the word 'bug' actually come from?
Related reading
2026-06-22
TCP vs UDP, Explained Through What Breaks When You Pick Wrong
TCP and UDP aren't interchangeable. We walk through the exact failure modes — head-of-line blocking, silent packet loss, Nagle delays — that show up when you pick the wrong transport.
2026-06-22
Write-Ahead Logging: How Databases Survive a Power Cut
How write-ahead logging keeps your data intact when the machine dies mid-write — the log-first rule, fsync, checkpoints, and why PostgreSQL and SQLite both rely on it.
2026-06-22
Backpressure, Explained Through a Queue That Won't Fall Over
What backpressure actually is, why an unbounded queue is a memory leak in disguise, and the four strategies a producer can take when a consumer falls behind.
2026-06-22
What a Bloom Filter Actually Saves You (and When It Lies)
A bloom filter trades a small false-positive rate for big memory savings. Here is the math behind the trade, where it pays off, and the failure mode that bites people.
2026-06-22
Idempotency, Explained Through the Retry That Doesn't Double-Charge
A practical look at idempotency keys: why a retried payment request shouldn't charge a card twice, how the pattern works, and where it quietly breaks in production.
Get the best tools, weekly
One email every Friday. No spam, unsubscribe anytime.