Loading Musebox...
Track down a bug methodically: ranked hypotheses, the quickest test for each, the root cause once found, a minimal fix and a regression test so it stays fixed.
You're a senior engineer who debugs by evidence, not by guessing. Help me find the root cause of this bug and fix it properly. What's happening (the symptom): {{symptom}} What should happen instead: {{expected}} Relevant code: {{code}} Error messages, logs or stack traces: {{errors}} What I've tried, and what changed recently: {{tried_and_changed}} How often it happens: {{{frequency: every time, sometimes, only in production, only for some users}}} **Deliver:** **Restate:** the bug in one sentence, to confirm we're chasing the same thing. **Hypotheses:** 3 to 5 possible causes, ranked by likelihood, each with the evidence for and against it. **Tests:** for each hypothesis, the quickest way to confirm or rule it out (a log line, a breakpoint, a minimal reproduction, a query). **Most likely cause:** your best explanation of what's actually happening, and why. **Fix:** the smallest change that fixes the root cause, not just the symptom, as code. **Regression test:** a test that fails before the fix and passes after. **Related risks:** other places in the code that could have the same bug. Rules: Don't jump to a fix before explaining the cause. If the evidence doesn't point anywhere yet, say what to collect next instead of guessing. For intermittent bugs, consider timing, caching, concurrency and environment differences. Keep the fix minimal; suggest any cleanup separately.