A well-known account of the origin of "bug" for a computer error has it that Grace Hopper (1906–92) coined the term or at least used it in jest after an actual moth got into a vacuum-tube installation and cause a short circuit.
It occurs to me that the expression may originally derive from the much older usage of "bug" in the sense of a disturbing or irritating annoyance. The current on-line edition of the Oxford English Dictionary defines this word:
an object of terror, usually an imaginary one; a bugbear, hobgoblin, bogy; a scarecrow
and suggests a connection to Welsh bwg [bʊg] 'a ghost' and to English bogey and bugbear. There are similar (if not cognate) forms in various other Celtic languages. The dictionary offers English citations from the 15th and 16th centuries onward. A 17th century text has "Timerous Fools, that are afraid of Buggs." This is the same sense as "gremlin", an imaginary and somewhat malicious creature to which we attribute problems in machinery. At present "computer bug" is not connected to bwg in the OED, but I find the idea of a link attractive.
The OED also relates our booger ("hard snot") to a regional US word booger defined "menacing supernatural creature; a goblin, bogy, or ghost"; an 1891 citation is the oldest supplied: "[A ball of mucus in the nose is] Called bugger in the South, the u sounded like [ʊ]." I suppose the key idea is that a booger "bugs" you.
Assuming the Welsh connection to boogeyman and its kin to be correct, I imagine that computer "bug" is the same morpheme. I wonder if anyone but me can be persuaded to begin calling computer bugs "bwgs" and pronouncing them as "boog" ([bʊg]); debugging would become "debwgging", and so on.