Skip to main content

How to Debug Without Changing Code in the Dark

How to investigate a bug in a disciplined way and reduce noise while you test hypotheses.

Andrews Ribeiro

Andrews Ribeiro

Founder & Engineer

The problem

Some bugs make the team so uncomfortable that the reaction turns into movement.

Not understanding. Just movement.

Then the sequence starts:

  • change the timeout
  • restart the service
  • comment a block out
  • add logs in ten places
  • change two configs

If the bug disappears, nobody knows why. If it stays, there is even more noise now.

Mental model

Debugging without criteria usually follows the wrong question:

“What can I change right now to see whether it goes away?”

Better debugging follows this one:

“What do I need to observe to reduce uncertainty before I change anything?”

That changes behavior a lot.

Instead of pushing the system around, you start framing the problem better.

Breaking it down

First define the real symptom

Before fixing anything, answer:

  • what exactly is wrong?
  • where does it appear?
  • how often does it happen?
  • who is affected?

Without that, you risk attacking a vague description instead of a concrete problem.

Then narrow the scope

Useful questions:

  • does this happen in one flow or many?
  • is it for every user or one segment?
  • did it start after which change?
  • does it happen only in production or also in staging or local?

Smaller scope means smaller search space.

Try to reproduce it with discipline

Not every bug reproduces easily.

But even when it does not reproduce perfectly, it is still worth trying:

  • a minimal path
  • one specific input
  • one timing or concurrency condition
  • one environment slice

Reproduction is powerful because it turns theory into observable behavior.

Change one thing at a time

This sounds basic, but it is what separates debugging from a lottery.

If you change many variables together, you lose the chance to know what actually influenced the result.

In debugging, experimental control matters.

Simple example

Imagine an intermittent error in checkout.

Weak reaction:

  • increase the timeout
  • change the call order
  • restart the pod
  • flip two flags

Better reaction:

  1. confirm whether the error happens in every payment method
  2. check when it started
  3. correlate it with a deploy or an external provider
  4. isolate one request with enough context
  5. test one hypothesis in a focused way

In the second case, the fix may take a few more minutes.

But the understanding usually comes much cleaner.

Common mistakes

  • trying to look fast instead of reducing uncertainty
  • confusing a behavior change with confirmation of cause
  • editing code before having a minimum slice of the problem
  • logging everything and still ending up with no useful signal
  • treating reproduction as always optional

How a senior thinks

More experienced engineers usually slow the room down before they speed it up.

The reasoning often sounds like this:

“If we change things before understanding them, we may reduce the symptom but lose the chance to explain the problem. First I want enough evidence to move in a clear direction.”

That posture looks slower to people who are anxious.

In practice, it usually saves time.

What the interviewer wants to see

In interviews, this topic measures technical discipline.

The evaluator wants to see whether you:

  • define the symptom before the solution
  • reduce scope
  • propose observation before editing
  • change one variable at a time

A strong answer often sounds like this:

“I would start by narrowing the symptom and the scope. Then I would try to reproduce the issue or at least correlate it with reliable signals. Only after that would I change one thing at a time to validate the hypothesis.”

Weak debugging looks like action. Strong debugging looks like investigation.

Quick summary

What to keep in your head

Practice checklist

Use this when you answer

You finished this article

Next article Distributed Tracing: What It Is and How to Use It to Debug Systems Previous article How to Explain Your Debugging Reasoning in an Interview

Keep exploring

Related articles