Schrödinger’s Bug and the Higgs-Bugson

By Gemma Penson - Computer Science Student @ Trinity Hall, Cambridge


Debugging is often a tension point for most programmers. Finding out why your program isn’t doing what you expect can be challenging and many resort to scattering the dreaded print statement throughout their code to locate its bugs. Debugging occurs frequently too, with professional programmers debugging their code once every eight minutes on average!

Think bugs are irritating? Well, imagine that the bugs can disappear when studied, have causes so complex they define repair or appear in running software which should never have worked in the first place!

The first of these bugs is known as a heisenbug and will indeed disappear or alter its behaviour when an attempt to find the source is made. This term is a pun on the name Werner Heisenberg, the physicist who first asserted the uncertainty principle in quantum mechanics. These bugs reduce the chance that a fix, once achieved, will cover all cases and it’s extremely difficult to pinpoint their source with certainty.

“I’ve spent every Tuesday for 2 months trying to track down a bug that only shows up in production on Tuesdays.” — Flufcake on Reddit

Heisenbugs often occur due to debugging attempts, such as inserting print statements and breakpoints, or due to using the value of a non-initialized variable. These cause side-effects such as changing memory addresses, slowing execution timings or running additional code which foster an environment for bugs.

One common example of heisenbugs is a bug that appears when a program is compiled with an optimizing compiler, but doesn’t appear when compiled without optimization by a debugger. This occurs because, whilst debugging, the values that an optimized program keeps in registers with a high range are pushed to lower-ranged main memory. This can cause variations in the result of floating-point number comparisons, for example.

Another type of bug is a mandelbug, which is named after mathematician Benoît Mandelbrot and his famous Mandelbrot set. These bugs have causes that are so complex that the bug becomes chaotic and incredibly resistant to fixes. They’re less-documented than heisenbugs, but this is likely because they occur around timing ambiguities and are difficult to replicate consistently. An example of a mandelbug goes beyond the space of this article, but feel free to explore the topic online!

Next up is the schrödinbug, named after Erwin Schrödinger and his famous feline thought experiment. These bugs will manifest in running software after a programmer notices that their code shouldn’t have worked in the first place, at which point the bug causes the program to stop working until it’s fixed. Though this sounds impossible, there are some documented cases online!

One such case occured when an error message was caused by some embedded code containing a switch() statement. Upon inspection, the programmers realised that the code shouldn’t have even compiled due to an unclosed bracket, but yet it was running! When the programmers recompiled the code, it did indeed fail but there was no previous version with the error message witnessed. How curious…

Lastly, we turn to a controversial category of bug known as the higs-bugson. Named after the Higgs boson particle, these bugs are predicted to exist based upon observed conditions, but are difficult, if not impossible, to artificially reproduce. Their observations are most commonly documented in vaguely related log entries or unverified user reports. As a result, many software engineers deny the existence of higgs-bugsons and offer alternative theories which normally blame the user.

Further reading:

  1. 2021. Alaboudi, Abdulaziz. An Exploratory Study of Debugging Episodes. [online]

  2. 1991. IEEE Computer Group News. Volume 21, Numbers 7-12.

  3. 2020. Weis, Or. Rookout. Fantastic Bugs And How To Resolve Them. Ep1: Heisenbugs [online]

  4. 2018. Flufcake. Reddit. I Hate Heisenbugs. [online]

  5. 2013. Schroedin Bug. [online]

  6. 2021. techopedia. What is a Mandelbug? [online]

  7. 2012. Bisson, Casey. MaisonBisson. Higgs-Bugson. [online]