At 3:45 in the afternoon on 9 September 1947, a room-sized computer stopped. The operators traced the failure to relay number 70, panel F, where a moth had become lodged between the contacts. They removed the insect, taped it into the machine’s logbook and wrote beneath it: “First actual case of bug being found.”

It is one of the best photographs in computing history: a dead-looking moth, a square of paper, and a sentence that appears to explain the origin of a word used every day. The story is true. It is also almost always told backwards.

The first actual bug

The machine was Harvard’s Mark II, an electromechanical calculator built from thousands of relays. A relay is a switch controlled by an electrical signal. In a modern computer, a fault may hide in a line of code too small to see. In the Mark II, a fault could be a bad connection, a damaged component or, on this particular afternoon, an insect physically interrupting the machinery.

The moth mattered because it made a metaphor literal. Engineers had already been calling difficult faults “bugs.” The logbook’s joke depends on that fact. “First actual case” does not mean “first time anyone used the word.” It means first time the people at the machine had found an actual creature matching the imaginary one they blamed for a problem.

The surviving object is now held by the Smithsonian’s National Museum of American History. Its catalog dates the logbook to 1947 and notes that it was probably not Grace Hopper’s, although Hopper was among the people working with the Mark II team. This correction does not make her connection to the story disappear. Hopper helped make the incident famous, and she kept returning to bugs in her notes, lectures and cartoons. It does mean that the familiar photograph is not evidence that she personally discovered the moth or coined the word.

There is another small correction hiding in the date. Some older captions gave the incident as 1945, and the Navy photograph once carried that date. The Mark II was not ready to test then. The surviving log and later historical work place the moth in 1947. The error survived because the photograph was memorable and the machine itself was not.

A word from the age of wires

The computer did not invent the bug. It inherited one.

In the nineteenth century, American telegraph and electrical engineers used bug for a fault that seemed to have burrowed into an apparatus. The image was useful precisely because it was vague. A problem might be a wiring mistake, a bad adjustment, an interaction nobody understood or a component that behaved differently from its specifications. Calling it a bug admitted that the thing was real without pretending that its cause had already been found.

Thomas Edison was using the word in his own technical world by 1878. In an 1878 letter, he described the little faults that appeared after the first burst of an invention: “Bugs” were the difficulties that required months of watching, study and labor. A newspaper account from 1889 explained a bug in Edison’s phonograph as if an imaginary insect had hidden inside it.

Edison did not need the moth to invent the metaphor. The metaphor was already old enough to be ordinary shop language. By the time the Mark I arrived at Harvard in 1944, IBM engineers had brought the term with them, and the Harvard staff used it for the troubles that appeared in both machinery and punched instructions.

One of the earliest surviving computer uses is not the moth’s label but a line in Robert Campbell’s Mark I logbook. On 17 April 1944, Campbell recorded that an IBM engineer was helping the staff find “bugs.” The machine had been using the word for years before any insect was taped to anything.

When debugging became a profession

The moth did not create the word. It gave the word an object.

That distinction helped the story travel. A technical term can be difficult to explain to someone who has never stood beside a relay cabinet. A moth is immediate. It turns a history of maintenance into a scene: the machine fails, people look inside, the culprit is pinned to the evidence. The joke also flatters the new technology. The first giant computers were supposed to be precise, abstract and mathematical. Their most famous failure was small, biological and faintly ridiculous.

The vocabulary spread gradually rather than all at once. Computer workers used bug, debug and debugging in documents and glossaries during the 1940s and early 1950s. Hopper was particularly enthusiastic about the language. In her papers, “debugging” could mean isolating a malfunction in a machine or removing an error from a routine. The word moved from the room where engineers repaired hardware into the new, less tangible territory of programs.

That change was more than a cute extension. A mechanical fault has a location. It may be possible to point to the loose wire or the burned relay. A program can fail while every component is functioning exactly as designed. Its instructions can be internally consistent and still produce the wrong result because a human translated an intention badly. The old word survived because it was broad enough to cover both kinds of uncertainty.

It also carried a quiet promise. A bug sounded like an intruder, not a permanent property of the machine. If an insect could be removed, perhaps an error could be found and expelled too. The metaphor made difficult work feel finite. Somewhere inside the system, something was hiding. Keep looking.

The moth and the myth

Origin stories prefer a single beginning. They want one person, one afternoon and one object that can be placed behind glass. The Mark II moth supplies all three, with Grace Hopper nearby to give the anecdote a memorable voice. It is a perfect story even after its strongest claim has been disproved.

The better account is less tidy. Engineers had used bug for technical faults since at least the 1870s. Harvard programmers were using it for computer problems by 1944. In 1947, a real moth interrupted a relay and gave them a chance to make a pun that preserved the distinction between an imaginary bug and an actual one. Hopper later helped carry that pun into the public history of computing.

The insect is therefore not the ancestor of the word. It is the word’s most successful illustration.

That may be why the story has lasted. The moth does not explain where debugging came from, but it shows what debugging feels like: a grand system brought to a halt by a cause that is both trivial and perfectly capable of stopping everything. Every modern program still contains the same possibility. Behind a screen, where no relay can be opened and no insect can be lifted out, an error waits for someone to turn a metaphor into a method.

Citations

  1. Peggy Aldrich Kidwell Stalking the Elusive Computer Bug. IEEE Annals of the History of Computing, 1998. (The history of bug as engineering slang, the Mark I's 1944 use of the term, the 1947 Mark II moth, and the gradual spread of bug and debug into computing)
  2. National Museum of American History Log Book With Computer Bug. Smithsonian Institution. (The surviving logbook, its moth, the wording 'first actual case of bug being found,' the 1947 date, and the evidence that the logbook was probably not Hopper's)
  3. Harvard Collection of Historical Scientific Instruments Harvard IBM Mark 1: Language. Harvard University. (The pre-computer engineering use of bug, Grace Hopper's bug cartoons, and the Mark II relay incident)
  4. I. Bernard Cohen The Use of 'Bug' in Computing. IEEE Annals of the History of Computing, 1994. (Robert Campbell's April 17, 1944 Mark I log entry referring to bugs, which predates the famous moth)
  5. Fred R. Shapiro Etymology of the Computer Bug: History and Folklore. American Speech, 1987. (The evidence that bug meant a defect in machines before computers, including Edison's 1878 usage and the 1889 published example, and the argument that the moth did not create the term)