Minimal repros are a fundamental tool when debugging.
First-and-foremost, you make repros for you.
Debugging is isolating. You cannot address what you cannot isolate. How can you fix a bug if you don't know where it is?
If a bug is fixed in a forest without a repro, is it even fixed?
How would you know if you even fixed it? This point is profound, so let me spell it out for you:
Fixing a bug means that the repro no longer repros.
This is similar to the maxim that you should never optimize without first measuring. If you try to make something faster without first measuring how fast it is, how will you know if you succeeded or made things worse? More importantly: how will you make sexy graphs you can brag about online?
When you ask for help with a messy, complex codebase, you're essentially asking a mechanic to clean out your car before they can diagnose the engine. That's your job. The isolation work is the prerequisite to getting help β not part of the help itself.
A good repro gets you:
People who help in forums, Discord servers, and GitHub issues are volunteering their time. Respect it.
The XY Problem: Sometimes while making a minimal repro, you'll realize you're asking for help with the wrong problem entirely. You thought you had a layout bug, but actually you're overriding styles elsewhere in your codebase. Read more about the XY Problem β
Minimal repros aren't just for humans anymore.
Got ChatGPT, Claude, or Copilot? A minimal repro is perfect for pasting into an AI assistant.
The smaller and more focused your code, the better the AI can understand and help. A 2000-line file will confuse it. A 20-line reproduction will get you a precise answer.
Even better, an AI agent can iteratively try to fix the bug, see if the repro still causes the issue, in a tight feedback loop, while you go out to lunch, and you can come back to a fix that's verified by the fact that the repro no longer repros!
Pro tip: you can now use AI to even help you make a minimal repro in the first place! Point it at this website (repro.fyi) and tell it to help you turn your bug into a minimal repro!
A great repro puts the other person into the bug as fast as possible. Here's what that looks like:
Write out the exact steps. Don't assume anything is obvious.
Expected: Validation error appears
Actual: Page crashes with white screen
Include the context that helps diagnose:
A video of you recreating the issue while talking through it is incredibly valuable. Describe:
The absolute best repro is one someone can run instantly:
If someone can click a link and see your bug, you've done so much of the work for them. They will know you respect them and their time.
"The app is broken. Please fix ASAP."
What's wrong with this?
Environment: Chrome 120, macOS Sonoma, Node 20.10.0
Steps:
- Open the dashboard (
/dashboard)- Click "Export Data" button
- Select "CSV" format
- Click "Download"
Expected: CSV file downloads
Actual: Nothing happens. Console shows:
TypeError: Cannot read property 'map' of undefined at ExportService.js:42Minimal repro: [CodeSandbox link]
Notes: Works fine with "JSON" format. Only fails with CSV.
Why this is better:
Another similar debugging technique is to use git bisect to find the offending
commit.
Somewhere in this process, you'll often go: "Wait, why did I write it that way?"
That's the magic. The minimal repro process forces you to understand your own code. And understanding is 90% of fixing.
Sometimes context matters. A minimal repro might not capture:
In these cases, be upfront: "I couldn't reproduce this in isolation, but here's what I've tried..." and provide as much context as you can about when/how it occurs.
Heisenbugs: Named after Heisenberg's uncertainty principle, these are bugs that seem to disappear or change behavior when you try to observe them. Common causes include timing-sensitive code (the debugger changes timing), memory issues masked by debug builds, or console.log statements that affect execution order. If you suspect a Heisenbug, document when it occurs vs. when it doesn't, and note whether debugging tools affect the behavior.
Before sharing your repro, verify each item.
repro.fyi β Because debugging is isolating, and isolation is your job.
Found this helpful? Share it with someone who sends you "it's broken" messages.
Have feedback or want to contribute? Edit this on Val Town β