Debugging bedbugs

One morning I woke up and found tiny bites all over my chest. I’m no stranger to mosquito and flea bites. These were definitely not those: too many for a mosquito, and no tell-tale red dot in the middle for fleas. “Bedbugs,” I thought, “must be.” After some Googling, I found images and descriptions of bedbug bites that matched mine. Unfortunately, the only way to be sure is to find bedbugs themselves.

I searched the bed but found no evidence of any bugs, let alone bedbugs. “That’s weird. Ninja bedbugs, must be.”

That night I wore some bug repellent and long sleeves. I found more bites on my abdomen in the morning. I searched the bed and found no trace of what must be highly trained, covert-ops bedbugs.

“Huh, weird.”

I laid traps. I put tape all around the bed, sticky side up. I put a dish of soapy water nearby and a bright, hot light above it. In the morning, more bites and no bugs. I read about bedbugs and spiders that crawl up the walls, across the ceiling and drop onto you, no wonder my traps were useless! Paratrooper bedbugs. They were biting my neck and face now, soon they would be feasting on my eyes.

Bisect

This went on for a few days and the bites started oozing pus. People were visibly afraid when they saw me, including the person at urgent care reception. At this point, unless I was haunted by ghost bedbugs, I probably had some other problem. I resorted to a method that I should have started with: bisecting.

Bisecting is searching for something by taking one known state (A) and another known state (C) to find a state in the middle (B). When debugging, we can use it to search for the source of the problem. We take a known good state (A) and a known bad state (C) and try to find the state in the middle where the problem starts (B).

(good) A -- B(?) -- C (bad)

If I had a time machine, I would go back to A and verify that it is does not contain the problem (ie. ghost bedbugs). Then, go to the time half way between A and C, to state B.

  • If B is good, you know the problem was introduced between B and C.
  • If B is bad, then you know the problem was introduced between A and B, or was introduced in B.

Then you bisect again between A and B if B is bad, or between B and C if B is good. Repeat until you find the source of the problem.

Not having a time machine, the next best thing is to just try to recreate the world at A. In my case, I tried to re-create all the inputs (food, water, air, sleep) to see what the output (horrific pus filled itchy hives all over my face) would be.

It works every time, except sometimes

The only problem with bisecting is that it requires you to know what the good state (A) is. If you choose the wrong place or time, it can lead you down a rabbit hole.

Did I mention I had my wisdom teeth removed about nine days before these bumps appeared? I knew I was fine before then, so I stuck my wisdom teeth back in. Just kidding, I stopped taking my painkillers and the bites went away after two days. I discovered I’m allergic to codeine.

There are more than a few ways that bugs can elude you, even when bisecting.

  1. A delayed cause and effect. In my case, the allergy did not manifest until after a week. Technically, my last known good state included the cause of the problem, I felt great for days after I started taking codeine.
  2. The bug may seem totally unrelated to the cause. For example, Google’s indexes seemingly failing at random and looking to the code when it was actually a hardware failure.
  3. Red herrings, issues that are unrelated or are symptoms instead of the actual cause. For example, not being able to send an email farther than 500 miles and thinking the problem was the distance instead of a timeout configuration mix up. Or, believing my hives were actually bedbug bites because they looked so much like them.

If something doesn’t feel right when debugging, stop and ask yourself if any of these may be the reason.

Beginner’s mind

I made the classic mistake of thinking I could diagnose a situation using experience and knowledge. The more experience and knowledge you think you have, the more likely you will make this mistake. Sometimes you get away with making intuitive decisions that are correct, and other times your assumptions will lead you astray. Once you start thinking about paratrooper bedbugs, try throwing out your assumptions and start from the beginning.

This practice can be found everywhere:

However you do it, go back in time to when you were smarter because you assumed less.

Just remember, if you ever feel broken by a problem, take a breath, don’t give up, check your assumptions, and bisect.


  1. For some reason, every article on this in the past few years includes Elon Musk 🤷‍♂️