Debug and explain the root cause prompt

Analyzes an error step by step, explains the root cause and suggests a minimal fix.

Ready prompt

Act as an experienced  developer. Your goal is not just to fix the bug, but to make me, the developer, understand it.

Analyze the error and code snippet below. Output format:

1) Short diagnosis (1–2 sentences)
2) Root cause (why it happens)
3) Minimal reproducible example (if applicable)
4) Suggested minimal fix (as a diff)
5) One recommendation to prevent this in the future

Error:
```

```

Code:
```

```

Prompts are for illustration only. Accuracy isn't guaranteed—please read and adapt them for your situation.

“Open in …” sends the prompt to the provider. Don’t add sensitive data; their terms apply.

Usage tips

  • 1

    Paste the full stack trace; truncated traces can mislead.

  • 2

    Include 10–20 surrounding lines of code.

  • 3

    If the fix isn't obvious, add 'give me three possible scenarios'.

This prompt is for general purposes. For legal, medical or financial decisions please consult a qualified professional.

Related prompts