on-this-day · september 9
the first computer bug, taped into the harvard mark ii log book. source: wikimedia commons
On this day in 1947 — The first computer bug was found, an actual moth stuck in the Harvard Mark II.
2 min read
On September 9, 1947, engineers working on the Harvard Mark II computer at the Naval Weapons Center in Dahlgren, Virginia, discovered that the machine had stopped working. The Mark II was a massive electromechanical computer, one of the first machines capable of performing complex calculations automatically. It filled an entire room and used thousands of electromagnetic relays to process data. When something went wrong, finding the cause was a tedious process of checking each relay by hand.
That afternoon, an engineer found the problem. A moth had flown into the machine and gotten trapped between the contacts of Relay Number 70 in Panel F. The insect had been crushed, creating a short circuit that caused the computer to malfunction. The engineers carefully removed the moth, taped it into their logbook, and wrote beside it: "First actual case of bug being found." The joke was intentional. Engineers had been using the term "bug" to describe mechanical and electrical faults for decades. Now they had found a literal one.
The moth itself still exists. It is preserved in the Smithsonian National Museum of American History, taped to the original logbook page. It has become one of the most famous insects in history, not because of anything it did, but because of what it represents. The moth is a physical artifact of the moment when computing transitioned from a purely mechanical process to something that required its own specialized vocabulary. Bugs, debugging, glitches,these terms emerged from the early days of computing, when machines were temperamental, failures were common, and finding the cause often required literal digging through hardware.
grace hopper — the computer scientist whose team found the moth and who helped popularize the term "debugging." source: wikimedia commons
The term "bug" did not originate with this moth. Thomas Edison used it in the 1870s to describe faults in his inventions. Engineers in the telegraph industry used it to refer to interference and equipment failures. But the Harvard Mark II moth codified the term in the context of computing. It gave the abstract concept of a software or hardware fault a tangible, relatable image. When programmers talk about debugging code today, they are using language that traces back to a room-sized computer, a logbook, and a dead moth taped to a page.
The Harvard Mark II was itself a transitional machine. It was one of the last major electromechanical computers before the industry shifted to fully electronic systems using vacuum tubes and, later, transistors. The Mark II used relays, mechanical switches that clicked open and closed to represent binary states. It was slow, loud, and required constant maintenance. Dust, humidity, and insects were all genuine threats to its operation. The moth was not an anomaly. It was an inevitability. Any machine that size, running in a non-climate-controlled environment, was going to attract pests.
a segment of the harvard mark i, the relay-based predecessor to the mark ii — these room-sized machines were vulnerable to dust, humidity, and insects. source: wikimedia commons
Modern computers do not have this problem. Solid-state electronics are sealed, miniaturized, and impervious to moths. But the language persists. Software bugs are not physical objects. They are logical errors, incorrect assumptions, unexpected interactions between components. Yet we still call them bugs, and we still talk about debugging, as if we were searching for an insect lodged in a relay. The metaphor stuck because it captured something essential about the work: the sense that somewhere, hidden in the machine, there is a small, fixable problem if you can just find it.
The moth in the logbook is a reminder that early computing was as much about physical engineering as it was about mathematics or logic. Computers were machines in the literal sense, with moving parts, heat, noise, and all the vulnerabilities that come with mechanical systems. The transition to software did not eliminate bugs. It just made them harder to see. You cannot tape a logic error to a page and display it in a museum. But you can trace its lineage back to a moth, a relay, and a logbook entry from September 9, 1947, when someone found the first actual case of a bug being found.