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 reliably2. Narrow down where it happens (logging, breakpoints, bisecting)3. Form a hypothesis about the cause4. Fix it and verify the symptom is gone5. Check you didn't break something elseModern 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-04
ACID vs BASE: What Database Guarantees Actually Promise
ACID and BASE describe two ends of a tradeoff between strict correctness and scalable availability. Learn what each guarantee means, when each fits, and why most modern databases sit somewhere in between.
2026-06-04
Big-Endian vs Little-Endian
Byte order explained: how big-endian and little-endian lay out multi-byte numbers in memory, why network protocols pick one, and when the difference actually bites you.
2026-06-04
Big-O Notation in Plain English
Big-O describes how an algorithm's runtime or memory grows as input grows. Learn the common classes — O(1), O(log n), O(n), O(n log n), O(n^2), O(2^n) — with plain examples.
2026-06-04
CORS in Plain English: Why the Browser Blocks Your Fetch
A clear walkthrough of CORS and the same-origin policy — what an origin is, why your fetch fails, how servers opt in, and the big misconception about who CORS actually protects.
2026-06-04
Environment Variables and PATH, Explained
What environment variables actually are, why they hold config and secrets, and how PATH decides which binary runs when you type a command.
Get the best tools, weekly
One email every Friday. No spam, unsubscribe anytime.