pickuma.
Dev Knowledge

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.

5 min read

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'?+
No. Hopper is associated with the 1947 moth incident and popularized the story for decades, but the word 'bug' for an engineering fault predates her and predates computing entirely. She helped make the term famous in computing lore, not coin it.
Is the moth story actually true, or a myth?+
It is true and documented. A moth really was found in a relay of the Harvard Mark II in 1947 and taped into the logbook with the note 'first actual case of bug being found.' The specimen and logbook page are preserved at the Smithsonian. Only the claim that this event originated the word is the myth.
Where does the word 'bug' actually come from?+
It was established engineering and telegraphy slang for an unexplained fault well before computers. Thomas Edison used it for glitches in his inventions in the 1870s. By the early 1900s it was common across technical fields, which is exactly why the 1947 logbook joke worked.

Related reading

See all Dev Knowledge articles →

Get the best tools, weekly

One email every Friday. No spam, unsubscribe anytime.