Esc
Technology

The Original 'Computer Bug' Was Literally a Moth

The term "computer bug" didn't come from a programmer's imagination. It came from an actual moth wedged inside the Harvard Mark II in September 1947.

\n\n

Most of us assume "bug" is a clever piece of slang—a metaphor that stuck because it captures the idea of a tiny flaw causing big problems. We imagine early programmers reaching for poetic language to describe mysterious malfunctions. In reality, the word probably entered computing vocabulary the way most jargon does: by accident, born from convenience, and then cemented by repeated use. We could have called them "gremlins" or "glitches." Instead, we call them bugs because once, literally, there was one.

\n\n

Here's what actually happened. Grace Hopper, one of the pioneering computer scientists of the era, was working with her team on the Mark II, a room-sized computer at Harvard University. The machine started malfunctioning. Rather than chasing some invisible software error, they traced the problem to its source: a moth had gotten stuck inside the hardware, physically jamming the system. They removed the insect and taped it directly into the computer's logbook—the actual record of the day's work. Next to the moth, someone wrote: "First actual case of bug being found." The pun was irresistible, and the terminology stuck.

\n\n

What makes this story genuinely strange is the timing and the permanence. By 1947, computers were already sophisticated enough that programmers had been finding non-moth-related errors for years. What made this moment different wasn't the discovery of a malfunction—it was the physical, undeniable presence of the culprit. The moth became the anchor for a term that would eventually describe problems that had nothing to do with insects. The logbook entry transformed a hardware failure into a founding myth for all of software debugging.

\n\n

The real puzzle is why this particular incident, and Hopper's documentation of it, became canonical. Hopper was prominent enough that her logbook got attention; others may have found actual bugs—in the literal sense—but didn't bother recording them, or their records were lost. The story also arrived at exactly the right moment: when computing was becoming professionalized, when people were starting to write about the field, when a good anecdote could become historical fact. Hopper herself was savvy enough to recognize the story's value, and she told it repeatedly in interviews and talks, ensuring it outlasted the Mark II by decades. The metaphor wasn't forced into existence; it just happened to be documented and then weaponized by someone important enough to make it stick.

\n\n

The deeper oddity is that we still use "bug" for errors that have absolutely nothing to do with hardware at all. A memory leak, an off-by-one error, a logic flaw in Python code—none of these have anything to do with insects or even physical objects. The term has become so abstract that its origin feels almost quaint. We use a word born from a literal insect to describe problems in pure mathematics and abstraction. That's the real anomaly: how a single, documented instance of hardware failure became the linguistic default for an entire class of problem that didn't exist in 1947 and has nothing in common with moths.