In engineering, a bug is a design defect in an engineered system that causes an undesired result.
Although used exclusively to describe a technical issue, bug is a non-technical term; applicable without technical understanding of the system.
The term bug applies exclusively to a system that is (human) designed; not to a natural system; and that the issue is within the influence of human control. For example, humans have faults but not bugs, and a server crash due to natural disaster is not a bug.
In addition to or instead of defect, some use: error, flaw or fault.
Engineered systems is a broad classification encompassing but not limited to: software, computer hardware, electronics, circuitry and machinery.
The undesirable result can be classified and described many ways including: intermittent, transient, glitch, crash or hang.
Since desirability is subjective, what is considered undesirable to one may be considered desirable to another; even a useful feature.