Why are computer errors called bugs?

Most computer bugs have no wings. A loop runs once too often. A button saves the wrong value. A program works on one machine and fails on another. Calling any of those problems a bug sounds odd until someone tells you about the moth found inside an early computer.
That story is true. The usual explanation attached to it is not.
The moth did not give programmers the word bug. It made an old engineering expression briefly, wonderfully literal.
The moth in the relay
On 9 September 1947, the team working on Harvard’s Mark II computer found a moth caught between relay contacts. They removed it and taped it into the machine’s logbook. Beside it, someone wrote: “First actual case of bug being found.” The Computer History Museum’s account identifies the machine, the date and the team.
The important word in the note is actual. Nobody would have written that line if bug had meant only an insect. The joke depended on the engineers already using it for a fault. This time, instead of an elusive problem hiding somewhere in the apparatus, they had an insect they could stick to the page.
It was a hardware problem, too: a physical relay contact in an electromechanical computer, not an error in a line of software. The logbook preserves an unusually photogenic example of a failure. It does not record the birth of the term.
The word was already decades old
The Edison Papers’ history of “bug” traces the technical use back to telegraphy. It cites a printed reference from 1875 and Edison’s laboratory notes from 1876, both long before a computer could trap a moth in a relay.
Edison used the word for troublesome faults in electrical apparatus. In an 1878 letter about the difficult work between an invention and a working product, he described bugs as “little faults and difficulties.” He was not talking about insects eating his equipment. He was talking about problems that appeared as the design was tested and refined.
The vocabulary also travelled beyond one inventor’s bench. According to the Edison Papers, an 1889 electrical dictionary described bug as a fault in a quadruplex telegraph; a dictionary published in 1892 gave it a wider meaning, covering faults in electrical apparatus generally. The exact first person who used the metaphor is harder to establish than these surviving examples. What the records establish clearly is that the word was engineering language before it was computer language.
That makes the 1947 note sharper, not less interesting. The team had spent years inheriting a way to name frustrating, hard-to-find faults. Then one day the metaphor arrived with antennae.
Where Grace Hopper fits
The moth is often credited to Grace Hopper alone, sometimes with the further claim that she coined bug or debugging. Those claims squeeze a team story and a much older word into a tidier origin myth.
Hopper was part of the Mark II world and helped make the episode famous in her later talks. The Computer History Museum describes a team finding the moth and Hopper being present; it does not name her as the person who discovered it. None of that diminishes her work. It separates what the record supports from the tidier version retold from memory.
The logbook’s line is a joke made by people who knew what a bug already was. Hopper helped keep the joke in circulation. That is a real part of the story without making her the inventor of the word.
What debugging kept
The modern bug is usually invisible. It might sit in a condition, an assumption about incoming data, a configuration file or the gap between what the user meant and what the program was told to do. There is rarely anything to pull out of a relay and tape into a notebook.
The old metaphor still fits because the symptom comes first and the cause has to be found. Good debugging starts by describing what happened, narrowing where it happened and testing an explanation. If talking through those steps helps, the rubber duck has its own history.
The moth did not invent computer bugs. It gave one a body, a date and a place in a logbook. That is why the story has survived so much longer than the fault itself.

