Every engineer who has ever chased a glitch through firmware has "debugged" something. The word is so ordinary now that almost nobody stops to ask where it came from. The answer is one of the best stories in computing history: on one particular day in 1947, the bug being removed from a computer was an actual insect.
A moth in Relay 70
On September 9, 1947, operators at Harvard University were running the Mark II Aiken Relay Calculator — a room-sized electromechanical machine built from thousands of relays, switches that physically clicked open and closed to represent ones and zeros. The Mark II started misbehaving, and the team went hunting for the cause. What they found was a moth that had become trapped inside one of the relays, physically obstructing the contacts and causing the fault.
The operators removed the moth, taped it into the machine's logbook, and wrote beside it: "First actual case of bug being found." That logbook page — moth still attached — survives today in the collection of the Smithsonian's National Museum of American History. It is one of the most famous artifacts in the history of computing.
Grace Hopper, the pioneering computer scientist who worked on the Harvard Mark series, loved to tell this story, and she is the reason most people know it. She was not necessarily present at the exact moment the moth was found, but she helped make the tale legendary, and her name is now inseparable from it.
Did the moth invent the word "bug"?
Not quite, and this is the part most retellings get wrong. Engineers had been calling technical faults "bugs" for decades before 1947. Thomas Edison used the term in the 1870s to describe glitches in his inventions, writing about "bugs" as small faults and difficulties that show up as a design gets closer to working. So the Harvard team already knew the word — that is exactly why the logbook joke lands. Writing "first actual case of bug being found" is funny because everyone already used "bug" to mean a metaphorical defect, and here was a real one.
What the moth story did do is cement the vocabulary and give "debugging" its perfect origin myth. The joke was too good not to spread, and it carried the words "bug" and "debug" from electrical engineering slang into the permanent language of software.
Why a 1947 moth still matters for modern IoT
It is tempting to file this away as trivia, but the moth points at something that has never stopped being true: the hard part of building computers is not making them work once — it is finding out why they stop working. In 1947 the culprit was a physical insect in a relay. Today the culprit might be a race condition in an interrupt handler, a memory leak that only appears after nine days of uptime, or a sensor that returns garbage in cold weather.
Embedded and IoT systems make this harder, not easier. A connected device often lives somewhere you cannot easily reach — on a rooftop, inside a machine, in a field far from the nearest engineer. You cannot open the logbook and look for a moth. Instead, the debugging has to be designed in from the start: clear logging, remote observability, watchdogs, and firmware that can be updated over the air when a bug does surface. A device that cannot tell you why it failed is a device that will eventually strand someone.
This is why we treat debuggability as a first-class feature when we build connected hardware and firmware, not an afterthought bolted on when something breaks. Good instrumentation early is the difference between a five-minute fix and a truck roll to a remote site.
The takeaway
The first computer bug was a moth, but the lesson is bigger than the insect. Every generation of technology finds new ways to fail, and the engineers who win are the ones who plan for failure before it happens. Nearly eighty years after that logbook entry, "debugging" still describes the most important work in the room.
If you are building an IoT product and want it to be diagnosable in the field instead of a black box, we would love to talk. We build reliable connected systems from silicon to cloud at fluidwire.com.
Top comments (0)