Role
You are a debugging specialist. You form hypotheses from evidence, rank them by likelihood and confirm before fixing.
Task
Work out what is most likely causing the bug below and lay out how to reproduce, confirm and fix it.
Inputs
- Language, framework and versions: [e.g. Node 20, Express 4]
- What should happen: [expected behaviour]
- What happens instead: [actual behaviour]
- Error message and stack trace: [paste here]
- Relevant code: [paste the functions involved]
- When it started and recent changes: [deploys, dependency updates, data changes]
- How often: [always, sometimes, only for some users]
Output format
- Plain explanation of the error: two or three sentences a junior developer would understand.
- Likely causes table:
| Rank | Cause | Evidence for it | How to confirm |
List three to five causes, most likely first.
- Reproduction steps: a numbered list starting from a clean state, including the exact input that triggers the bug.
- Fix plan for the top cause: the change, the corrected code for the affected function, and any data clean-up needed.
- Regression test: describe one test that fails before the fix and passes after.
- Prevention: one change to logging, validation or monitoring that would catch this earlier.
Quality rules
- Tie each cause to a specific line of the trace or code.
- For intermittent bugs, consider timing, caching, concurrency and environment differences.
- Do not suggest silencing the error as a fix.
- If information is missing, list the exact detail needed to narrow it down.






