The day a machine stopped because of a moth

On September 9, 1947, something went wrong inside a machine that looked less like a modern computer than an industrial monster.

The Harvard Mark II was an enormous electromechanical calculating machine built from hundreds of thousands of components, miles of wiring and a forest of mechanical relays. It did not have a screen glowing with windows and icons. It clicked, hummed and clattered its way through calculations.

And then it stopped behaving properly.

Engineers began searching for the reason.

They checked the machine.

They traced the circuitry.

They inspected the relays.

And eventually they found the culprit.

A moth.

The insect had become trapped between the contacts of Relay #70 on Panel F. The engineers removed it, preserved it in the machine’s logbook and wrote a wonderfully understated sentence beneath it:

“First actual case of bug being found.”

The date was September 9, 1947.

The moth was real.

The logbook is real.

The relay was real.

And the phrase became part of computing folklore.

But there is a problem.

The moth was not the first computer bug.

In fact, the word bug had already been used by engineers to describe faults in machines for decades.

And even more surprisingly, programmers were already using bug and debugging around the time of the Harvard computers.

So the famous moth story is true but the popular version of what it means is not.

That distinction opens a much more interesting story about how computing inherited an old engineering word, how Grace Hopper helped popularize it, and how a dead insect eventually became one of the most famous specimens in the history of technology.

The machine that became the crime scene

The Harvard Mark II belonged to an era when computers were not yet mysterious black boxes sitting quietly on desks.

They were physical.

Very physical.

The Mark II was an electromechanical computer developed at Harvard with IBM involvement under the direction of Howard Aiken. It was designed to perform complex calculations for the U.S. Navy, and its technology depended heavily on relays electromechanical switches that physically opened and closed electrical circuits.

That physicality mattered.

Modern software can fail because of a misplaced character in a line of code.

The Mark II could fail because something physically got between two electrical contacts.

The machine’s relays were constantly switching.

Click.

Click.

Click.

Thousands of such operations could occur while calculations were being performed.

A foreign object in the wrong place could interrupt the process.

And in September 1947, that foreign object happened to have wings.

The Smithsonian’s National Museum of American History preserves the original logbook containing the moth. Its collection record identifies the object as a 1947 logbook associated with the Harvard Mark II and notes that the moth was taped into the book after being found in the machine.

The physical evidence is therefore unusually good for a story this old.

We do not merely have somebody remembering a funny incident decades later.

We have the log.

We have the insect.

We have the date.

We have the machine.

What became complicated was everything people later claimed the incident proved.

The moth was not “the first bug”

This is where the story needs a correction.

The word bug did not originate with computers.

Engineers had been using it to describe faults, defects and unexpected problems in machines long before the Harvard Mark II existed.

The Smithsonian notes that American engineers had used bug for small mechanical or electrical flaws for more than a century and specifically points to Thomas Edison using the term in connection with electrical problems during the 1870s.

That means the popular story—

“A moth got into a computer, so programmers began calling errors bugs.”

is historically too neat.

The reality is much more human.

Engineers already had a useful word.

Computers inherited it.

The moth simply produced an almost perfect visual joke.

A “bug” was causing a machine to malfunction.

And this time, there was literally a bug inside it.

That coincidence was so good that history remembered it.

Edison had already been talking about “bugs”

Thomas Edison was using bug in an engineering context in the nineteenth century.

This is important because it destroys one of the most persistent myths surrounding the Harvard moth.

The word did not suddenly appear in computer science in 1947.

According to the Smithsonian’s historical research, Edison was already discussing “bugs” in electrical systems in the 1870s. Historian Peggy Aldrich Kidwell’s study of the term likewise traces its engineering use back at least to Edison’s era.

The meaning was essentially familiar:

Something is wrong with the machine, but we don’t yet know exactly what.

That is surprisingly close to how programmers still use the word.

A bug is rarely just “a mistake.”

It is an unwanted behaviour whose cause must be found.

That makes the word remarkably useful.

Then computers arrived and inherited the problem

The first generations of computers were not born into a clean world where software and hardware were neatly separated.

They were machines.

Their failures could come from wiring, electrical contacts, vacuum tubes, punched tape, mechanical movement, timing, human instructions or combinations of all of them.

In other words, early programmers were simultaneously engineers, mathematicians, operators and detectives.

Grace Hopper became one of the most important figures in this transition.

After serving in the U.S. Navy during World War II, Hopper worked at Harvard’s Computation Laboratory, where she helped program the Mark I and Mark II. The U.S. Naval History and Heritage Command records her work on the Harvard computers before she later moved into commercial computing and became one of the pioneers of compiler development.

Hopper also became one of the great storytellers of early computing.

And that is where the moth acquired a second life.

Grace Hopper and the story that became bigger than the insect

Hopper was associated with the Mark II team, but one important detail is often lost in simplified retellings:

She was not necessarily the person who physically discovered the moth.

The U.S. Navy’s own account says that the operators found the insect, attached it to the logbook and recorded the famous line. It also notes that Hopper was not present when the moth was discovered, although she later helped make the story famous.

Hopper herself acknowledged aspects of this story in later interviews.

In a 1969 oral-history interview preserved by the Smithsonian, she described how the Mark II team encountered a moth in one of the relays and taped it into the logbook.

Her storytelling mattered enormously.

She had a gift for turning complicated computing history into memorable human stories.

And what story could possibly be better than this?

A giant machine stops.

Engineers investigate.

They find an insect.

They remove it.

They “debug” the machine.

It was funny.

It was visual.

And, crucially, it was true.

But “debugging” existed too

This is where the historical puzzle becomes even more fascinating.

If bug was already an engineering term, then perhaps debugging was not invented by the moth either.

Correct.

The evidence indicates that bug and debug were already circulating in engineering and computing contexts before the famous 1947 incident.

The Smithsonian’s research explicitly cautions against treating the moth as the origin of the terminology. Its collection description says engineers had been using bug for machine problems for over a century and that early computer workers were already dealing with bugs in hardware and programs before 1947.

This changes the story completely.

The moth did not invent the word.

It gave the word a photograph.

Or, more precisely, it gave the word a specimen.

So what exactly happened on September 9?

The surviving logbook gives us an unusually precise snapshot.

The day’s entries record testing activity and, at 15:45, identify:

“Relay #70 Panel F (moth) in relay.”

Immediately beneath it appears:

“First actual case of bug being found.”

The Computer History Museum reproduces the logbook chronology and identifies the September 9, 1947 incident as the famous moth discovery.

The Smithsonian collection gives the physical dimensions of the surviving logbook as approximately 48.4 × 29.5 centimetres, with the preserved moth and tape forming part of the historical object.

There is something almost comic about the precision.

A giant machine experiences a failure.

And someone records the exact relay.

The exact panel.

The exact time.

And then preserves the culprit.

It is engineering documentation meeting human humour.

Why was a moth capable of stopping a computer?

Because the Mark II was not a modern solid-state computer.

Its relays were physical switching devices.

A relay works, in simplified terms, by using an electrical signal to move a mechanical contact between states.

That means there are moving parts.

And where there are moving parts, there are opportunities for physical interference.

A moth trapped between contacts could prevent the circuit from operating correctly.

This is one reason the story is actually more interesting than the modern joke suggests.

The insect was not a metaphor.

It was a hardware fault.

The computer really had an insect problem.

The machine had been “bugged” in the most literal possible sense.

The great misunderstanding: hardware bug versus software bug

This is where modern readers often confuse two completely different things.

A hardware bug is a physical or electrical problem in the machine.

A software bug is an error or unexpected behaviour caused by instructions, logic, data handling or the interaction of software components.

The moth was a hardware bug.

It was not a software error.

FeatureHarvard mothModern software bug
TypePhysical hardware problemProgram/system problem
CauseMoth trapped in relayIncorrect logic, data, assumptions or implementation
LocationRelay #70, Panel FCode/software environment
DateSeptember 9, 1947Modern usage continues
EvidencePhysical moth + logbookSource code, tests, logs and system behaviour
“Debugging”Physical inspection and removalDiagnosis, testing and code correction

The distinction sounds obvious today.

In 1947, however, computers were still emerging from the world of machinery.

Hardware and software were not yet culturally separated in the way they are now.

The famous moth therefore sits at an important historical crossroads.

It represents the moment when the old language of mechanical engineering was becoming part of the new language of computing.

Then what was the first software bug?

Here the honest answer is less satisfying:

There is no universally accepted single “first software bug.”

And that is precisely why articles claiming that the 1947 moth was “the first software bug” are misleading.

The moth was a physical fault.

Software bugs existed as soon as programmers wrote instructions complex enough to produce unintended results.

Early programmers encountered incorrect calculations, faulty logic, timing problems, erroneous instructions and unexpected interactions long before software engineering became a formal discipline.

The difficulty is historical evidence.

A physical moth can be preserved.

A software error from the 1940s may exist only in a programmer’s notes, a discarded punched tape, an experimental program or an undocumented debugging session.

There is therefore no convenient insect-sized artifact that historians can point to and say:

“There. That was definitely the first software bug.”

The history of software failure is much more diffuse.

The moth became famous because it was perfect storytelling

Why, then, did this particular incident survive?

Because it had everything a historical anecdote needs.

There was a famous machine.

There was an emerging technology.

There was a malfunction.

There was a detective story.

There was an actual insect.

There was a handwritten note.

And there was a perfect pun.

The phrase “first actual case of bug being found” transformed an ordinary maintenance event into an artifact of technological culture.

The Smithsonian later mounted an exhibition called “Stalking the Elusive Computer Bug,” which ran from November 1997 to April 1998 and featured the moth alongside documents, photographs and material illustrating the history of computer bugs.

Think about that transformation.

In 1947, it was a dead moth in a machine.

Decades later, it was museum history.

The moth also tells us something about Grace Hopper

It would be unfair to remember Hopper merely as “the woman associated with the moth.”

Her importance to computing was vastly larger.

She helped develop early programming practices, later worked on compiler technology and played a major role in the development and standardization of COBOL. The U.S. Navy’s historical record credits her with major contributions to programming and computing across her long career.

But the moth story tells us something about her personality.

Hopper understood that computing could be intimidating.

Machines were enormous.

Programs were abstract.

The mathematics could be intimidating.

So she often used humour.

A moth gave people something they could understand immediately.

A computer had a bug.

You found the bug.

You removed it.

You debugged the machine.

Suddenly an intimidating technological idea had a human face.

The timeline behind the myth

YearWhat happened
1870sThomas Edison used “bug” in connection with engineering/electrical problems
1940sEarly computer engineers and programmers were already encountering hardware and programming “bugs”
1947Moth found in Harvard Mark II relay
September 9, 1947Moth entered into the Mark II logbook
Later decadesGrace Hopper repeatedly helped popularize the story
1988The preserved logbook was rediscovered at the Naval Surface Warfare Center museum at Dahlgren
1997–1998Smithsonian exhibition “Stalking the Elusive Computer Bug” featured the artifact
Today“Bug” and “debugging” are standard vocabulary in software engineering

The U.S. Navy records the rediscovery of the logbook in 1988, when the moth was still attached to the page.

The object eventually entered the Smithsonian’s National Museum of American History collection.

So the moth did not merely survive inside a machine.

It survived history.

What the story gets right and what it gets wrong

The cleanest way to understand the legend is to separate fact from folklore.

True

The Harvard Mark II malfunctioned.

A moth was found trapped in a relay.

The insect was attached to the machine’s logbook.

The entry was dated September 9, 1947.

The logbook described it as the “first actual case of bug being found.”

Grace Hopper was part of the broader Mark II team.

She later helped popularize the story.

The physical artifact survives in the Smithsonian collection.

Misleading

The moth did not invent the word “bug.”

It was not necessarily the first time the word had been used for a computer problem.

It was not the first software bug.

And Hopper was not simply an engineer who personally discovered the insect and invented “debugging” on the spot.

The deeper historical record is more complicated and therefore more interesting.

Why the myth survived when the truth was better

This is a familiar pattern in technology history.

Real history is messy.

Myths are elegant.

The myth says:

Moth enters computer → computer fails → moth removed → “bug” is born.

It takes five seconds to tell.

The truth requires a paragraph:

Engineers had already used bug for technical failures. Early computing inherited that vocabulary. The Harvard Mark II suffered a physical malfunction caused by a moth in a relay. The team documented it humorously. Grace Hopper later became one of the major storytellers associated with the incident. The event then became symbolic of debugging.

The second version is longer.

But it explains something the first cannot:

Why the word survived even after computers stopped having insects inside them.

The strange afterlife of the word “bug”

Today, when a banking application displays the wrong balance, we call it a bug.

When a phone crashes after an update, we call it a bug.

When an autonomous system behaves unexpectedly, engineers investigate bugs.

When a spacecraft’s software produces the wrong result, engineers search for software faults.

The machines have changed almost beyond recognition.

The vocabulary has not.

That is because bug has become more than a reference to an insect.

It is now a compact word for unexpected behaviour produced by a complex system.

And perhaps that is why it survived.

A bug is something that makes a system behave differently from what its creators intended.

That definition works for a relay.

It works for a program.

It works for an operating system.

It works for a billion-line software platform.

The moth merely gave the metaphor a body.

The modern lesson hidden inside a dead moth

There is a deeper reason this story still matters.

Modern computing has become so abstract that we sometimes forget computers are still physical systems.

Software may appear weightless.

It isn’t.

It runs on processors.

Processors depend on electrical signals.

Electrical signals depend on physical materials.

Materials heat up.

Memory fails.

Networks lose packets.

Sensors produce bad data.

Power fluctuates.

Human beings make assumptions.

And complex systems interact in ways their designers did not anticipate.

The Mark II moth was therefore an early warning from the physical world:

A computer does not care whether the mistake is elegant.

A programmer can write ten thousand perfect lines of code and still have a machine fail because something physical went wrong.

Conversely, a perfect machine can execute flawed instructions flawlessly.

That distinction became one of the central truths of computer engineering.

The little insect that became a giant metaphor

The Harvard moth was tiny.

The historical consequence was not.

It helped give future generations of programmers a story for something they would encounter repeatedly:

something is wrong, but we don’t yet know why.

That is what debugging really is.

Not merely deleting mistakes.

Not merely fixing code.

It is the systematic search for the difference between what a complex system should do and what it actually does.

The moth did not create that idea.

Humans had been doing it for centuries.

But on September 9, 1947, the idea acquired a mascot.

A dead moth was taped to a page.

Someone wrote a joke beneath it.

And eventually millions of programmers inherited the joke without knowing the whole story.

The final irony

There is something beautifully appropriate about the fact that the most famous “computer bug” was not really a software bug at all.

Today, bugs live inside code.

They hide in algorithms.

They wait inside operating systems.

They appear after updates.

They crash websites at three in the morning.

They cause engineers to stare at screens for hours wondering what on Earth went wrong.

But the most famous bug of all was much simpler.

It had wings.

It got stuck in a relay.

Someone pulled it out.

And then somebody had the good sense to save it.

That is why the Harvard moth deserves to be remembered not as the insect that invented the word bug, because it did not, and not as the first software bug, because it wasn’t.

Its real significance is more subtle.

It was the moment when an old engineering joke became permanently attached to the new world of computing.

A machine failed.

A moth was found.

A pun was written into a logbook.

And history did the rest.

The Unfoldings

  • The famous Harvard Mark II incident occurred on September 9, 1947.
  • A moth became trapped in Relay #70, Panel F, causing a malfunction.
  • Engineers preserved the insect in the machine’s logbook.
  • The entry described it as the “first actual case of bug being found.”
  • The term bug was not invented by Grace Hopper or the moth.
  • Engineers had used bug for technical problems since at least the nineteenth century.
  • The moth was a hardware bug, not a software bug.
  • There is no universally accepted single event that can honestly be called the first software bug.
  • Grace Hopper helped make the moth story famous and became one of the most important figures in early programming.
  • The original logbook and moth survive as historical artifacts at the Smithsonian.
  • The story’s lasting importance comes from the way it connected an old engineering term with the emerging culture of computer programming.

Frequently Asked Questions

Was the Harvard moth really the first computer bug?

Not in the broad historical sense. It was the famous “first actual case of bug being found” documented in the Mark II logbook, but engineers had already used bug to describe technical faults, and computers had experienced other faults before 1947.

Did Grace Hopper discover the moth?

Hopper was part of the Mark II team and later became closely associated with the story, but historical accounts indicate that she was not necessarily present when the moth was physically discovered.

Did the moth cause a software error?

No. It was a physical hardware problem. The moth became trapped in an electromechanical relay.

Where did the word “bug” come from?

The word predates computers. Engineers had used bug for defects and malfunctions in technical systems, with documented nineteenth-century examples associated with Thomas Edison.

What is the difference between a bug and debugging?

A bug is an unintended fault or behaviour in a system. Debugging is the process of locating and correcting its cause.

Is the original moth still preserved?

Yes. The Smithsonian’s National Museum of American History holds the Mark II logbook containing the preserved moth.

Why did the story become so famous?

Because it combined a genuine engineering failure with an almost perfect pun. The physical insect made the abstract idea of a computer “bug” instantly memorable.

Authentic sources and references

Smithsonian Institution

The National Museum of American History holds the original Harvard Mark II logbook and preserved moth. Its catalogue explains the historical development of the word bug and explicitly notes that engineers were using the term long before the 1947 incident.

Computer History Museum

The Computer History Museum’s historical timeline records the September 9, 1947 incident and identifies the moth as being found between relay contacts of the Harvard Mark II.

U.S. Navy / Naval History and Heritage Command

The U.S. Navy’s historical material documents Grace Hopper’s involvement with the Harvard computers and her later role in popularizing the computer-bug story.

U.S. Department of the Navy — CHIPS

The Navy’s CHIPS publication provides historical information about the moth, the relay location, the logbook and its later rediscovery at Dahlgren in 1988.

Smithsonian / IEEE historical research

Peggy Aldrich Kidwell’s “Stalking the Elusive Computer Bug,” published in IEEE Annals of the History of Computing, examines the historical use of bug and its relationship to early computing. The Smithsonian catalogues the work as a study of the terminology and history of computer debugging.

Grace Hopper oral history

A Smithsonian-preserved 1969 oral-history interview with Grace Hopper provides her own recollection of the moth incident and the early Harvard computing environment.

Related government and institutional resources

  • Smithsonian National Museum of American History: Harvard Mark II computer bug logbook and preserved moth.
  • U.S. Naval History and Heritage Command: Grace Hopper’s computing career and Harvard work.
  • U.S. Navy CHIPS: Historical account of the Mark II moth and its rediscovery.
  • Computer History Museum: 1947 computer-history timeline and Mark II incident.

You may also like to read:

  1. The Soviet Space Mission That Ended With a Door Problem — how a tiny mechanical failure caused a fatal spacecraft disaster.

Leave a Reply

Your email address will not be published. Required fields are marked *

Trending

Categories