Common Bugs with Debugging (Yes, Really)
Meta-bugs: things beginners do while debugging that make debugging harder.
From Bee: "I see this exact bug in beginners every week. Read it once, and you'll spot it on yourself before it bites."
Changing two things at once
txt
Bug. Add try/catch + change algorithm. Now works. Why? No idea.β οΈ
Why this happens
You can't tell which change fixed it. The other change might be hiding a different bug.β
The fix
Change one thing at a time. Test. Then change the next.Skipping the error message
txt
"It just doesn't work" β without quoting the actual error.β οΈ
Why this happens
The error often spells out the answer. Beginners panic and don't read it.β
The fix
Read the LAST line first (the actual error), then walk up the stack trace for context.Modifying production data while debugging
txt
console-edit a record on prod to "see what happens"β οΈ
Why this happens
Now your data is wrong AND you've lost the ability to reproduce the bug.β
The fix
Reproduce locally first. Touch prod data only with intent and a backup.Forgetting to remove print statements
js
console.log("DEBUG", user);
// ships to productionβ οΈ
Why this happens
Logs leak data and clutter logs in prod.β
The fix
Use a logger with levels (debug/info/warn) and disable debug in prod. Or grep before commit.Believing "it works on my machine"
txt
Local: works. CI: fails. "Must be CI's fault."β οΈ
Why this happens
Usually a difference in env vars, file paths, locale, dependency versions, or DB seed data.β
The fix
Reproduce in a clean container. The difference between "works locally" and "fails in CI" is real configuration.π‘
Want the full lesson?
Read Debugging β the complete lesson, or test yourself with the quiz.