Start.dev
Back to blog

How to tell a debugging story in an interview

A plain way to tell an interview story about a bug you fixed: what broke, what you checked to narrow it down, and what you changed.

Ariel Weinberger
Ariel Weinberger · 7 min read

An interviewer asks, "Tell me about a bug you fixed." What do you say?

Short answer: tell it in four steps. What broke, what you checked to narrow it down, what the cause turned out to be, and what you changed so it stays fixed. The middle step, how you searched, is the part that matters most.

This post gives you that structure, a worked example with a small bug, the follow-up questions to expect, and the mistakes that make a real fix sound like luck. You don't need a dramatic production outage. A small bug you can explain clearly is enough.

Why interviewers ask this

Every developer spends a big part of their time on code that doesn't work yet. This question is a way to see how you behave in that moment:

  • Do you work methodically, or guess? Changing random lines until it works is a different skill from narrowing the problem down.
  • Do you read error messages and output? Or do you skip past them?
  • Do you find the cause, or just the symptom? A fix that hides the problem tends to come back.
  • Can you explain it? On a team, you will describe bugs in tickets, pull requests and standups.

That is why the story of how you searched beats the story of how clever the fix was.

The four steps

  1. What broke (15 seconds). The symptom, in one or two sentences. What you expected, and what happened instead.
  2. How you narrowed it down (45 seconds). What you checked, in order, and what each check told you. This is the heart of the story.
  3. The cause (20 seconds). The actual reason, in plain words.
  4. The fix, and what you changed afterwards (20 seconds). What you changed in the code, and what you did so it wouldn't happen again, like a test or a check.

That is under two minutes. Then stop and let them ask.

A worked example: the missing last item

Say you wrote a small program that prints a receipt from a list of items and totals the prices. Here is the buggy version:

function printReceipt(items) {
  let total = 0
 
  for (let i = 0; i < items.length - 1; i++) {
    console.log(`${items[i].name}: $${items[i].price}`)
    total += items[i].price
  }
 
  console.log(`Total: $${total}`)
}
 
printReceipt([
  { name: "Coffee", price: 3 },
  { name: "Bagel", price: 2 },
  { name: "Juice", price: 4 },
])
// Coffee: $3
// Bagel: $2
// Total: $5

Here is how the four steps might sound out loud.

What broke: "I was building a receipt printer. With three items, the total came out as 5 instead of 9, and the receipt only listed two items."

How you narrowed it down: "First I checked the input, because if the list was wrong, nothing else mattered. I logged items.length and it was 3, so the data was fine. Next I noticed the total was exactly the first two prices added up, so the math worked but something was being skipped. Then I compared the printed lines with the list, and it was always the last item missing, whatever the list had in it. That pointed at the loop, not the prices."

The cause: "The loop condition was i < items.length - 1. With three items, that stops when i reaches 2, so the item at index 2, the last one, never ran."

The fix: "I changed it to i < items.length. Then I tested a list with one item and an empty list, because those are where off-by-one bugs usually hide. Later I switched to for...of, which loops over every item without managing an index at all, so that kind of mistake can't happen."

for (const item of items) {
  console.log(`${item.name}: $${item.price}`)
  total += item.price
}

Notice the shape of the middle step. Each check either ruled something out or pointed somewhere. The input is fine. The math is fine. It is always the last one. That is what a methodical search sounds like, and it is far more convincing than "I spotted it eventually".

How to find your own story

You almost certainly have one already. Look for:

  • A bug where the error message pointed somewhere unexpected. Explaining why the message was misleading shows you read it carefully.
  • A result that was slightly wrong. Off-by-one errors, wrong totals, a list in the wrong order. These have clear causes and make clean stories.
  • Something that worked in one case but not another. "It worked for two items but not for one" gives you a natural place to start narrowing down.
  • A bug you caused yourself. That is fine, and honest. Interviewers know everyone writes bugs.

If you genuinely can't remember one, take a small project you built, break something on purpose, and fix it while noting each step. Then tell that story honestly as practice you did, not as a crisis that never happened.

Questions to expect

They askWhat they want to knowHow to answer
"What did you check first, and why?"Whether you had a reasonName the first check and what it would rule out
"How did you know that was the cause?"Whether you confirmed itSay what you changed and what you saw afterwards
"What would you do if that hadn't worked?"Whether you have more than one toolName the next thing you would check
"How do you stop it happening again?"Whether you think beyond the fixA test, a check, or a simpler way to write it
"Did you use AI or search for help?"Honesty and judgmentSay what you asked and how you checked the answer

Using a search engine or an AI assistant is normal. What interviewers listen for is whether you understood the answer before you used it. Are coding interviews dead? What AI changed covers how that has shifted.

Common mistakes

  • Skipping the search. "It was broken, then I fixed the loop" leaves out the only part they wanted to hear.
  • Picking a bug you can't explain. If the fix was "I reinstalled something and it worked", you can't say why. Choose a bug where you know the cause.
  • Making it too technical too fast. Start with the symptom anyone can picture, like a wrong total, before you get to the loop condition.
  • Blaming tools or teammates. Even if a library was at fault, focus on what you did to find it.
  • Inventing drama. A made-up outage falls apart under follow-up questions. A small, true bug holds up.

Quick recap

  • Use four steps: what broke, how you narrowed it down, the cause, the fix.
  • The middle step matters most. Say what each check ruled out.
  • A small bug told clearly beats a big one told vaguely.
  • Mention what you did so it wouldn't come back, like testing edge cases.
  • Keep it under two minutes, then let them ask.

Frequently asked questions

What if I have never fixed a serious bug?

That is fine for a junior role. Small bugs from practice projects work well because you understand them completely. What matters is how you found the cause, not how big the bug was.

How technical should the story be?

Start with the symptom in plain words, then get as technical as the cause needs. Be ready to show the line of code if they ask, but don't lead with it.

Is it okay to say I asked for help?

Yes. Say who or what you asked, what you learned, and how you checked it. Knowing when to ask is part of the job.

Should I prepare more than one story?

One well-prepared story is enough for most interviews. A second, different kind of bug is useful if you have several rounds.

How is this different from talking about a project?

A project walkthrough covers what you built and why. A debugging story zooms in on one problem and how you solved it. How to explain a coding project in an interview covers the first one.

Practice

Build a small project, then keep notes the next time something breaks: the symptom, each thing you checked, and the cause. Project Receipt Printer (opens in a new tab) is a good place to start, because loops and totals are exactly where small, explainable bugs show up. It runs in your browser, so there is nothing to install. Then practise the four steps out loud and time yourself.

Keep going

JavaScript Basics (opens in a new tab) is full of small projects you can understand line by line, which is what makes a debugging story easy to tell. For the technical questions that often come next, read JavaScript interview questions for junior developers.

Level up your coding skills

Jump into interactive courses and start building real-world projects.

Start learning

Related posts

A plain way to walk through a small coding project in an interview: what you built, where you got stuck, and what you would change next.
Ariel Weinberger
Ariel Weinberger · 7 min read
Ten JavaScript interview questions junior developers get asked, with short answers, runnable examples, and the follow-ups interviewers like to ask next.
Ariel Weinberger
Ariel Weinberger · 5 min read
Coding interviews are not disappearing, but AI is changing their format. Here is what current hiring data says and how developers should prepare.
Ariel Weinberger
Ariel Weinberger · 8 min read