← Back to Prompt Library

πŸ’» Coding & Development

Debug Any Error Message

Paste an error message and the related code to get the likely root cause, a fix, and how to prevent it next time.

The Prompt β€” replace [BRACKETS] with your details

Act as a debugging expert. Help me fix this error.

Language/framework: [LANGUAGE/FRAMEWORK]
What I was trying to do: [SHORT DESCRIPTION]
What I already tried: [WHAT YOU TRIED, or "nothing yet"]

Error message:
```
[PASTE FULL ERROR MESSAGE / STACK TRACE]
```

Relevant code:
```
[PASTE THE RELATED CODE]
```

Respond with:
1. The most likely root cause in plain language
2. The exact fix (show corrected code)
3. If you're not certain, the top 2-3 hypotheses ranked by likelihood, each with a quick way to test it
4. One tip to avoid this class of bug in the future

How to use this prompt

  • Always include the full stack trace β€” the last few lines matter most.
  • Mention what you already tried so you don’t get the same suggestions back.

Works well with

ChatGPT
Claude
DeepSeek
Gemini

Need a custom version of this prompt?

The free prompt generator builds a prompt tailored to your exact goal, framework, and target AI model β€” or paste this template into the optimizer to refine it.