
- Updated
Debug an error message step by step: AI prompt
This prompt is for when you have an error and do not yet know why. You paste the error or stack trace, your language and version, the code that triggers it and what you already tried. The AI explains the error in plain English, lists the three most likely causes in order, shows how to test each one quickly and gives corrected code for the most likely fix. Use the smallest snippet that reproduces the problem.
I get this error: [PASTE ERROR OR STACK TRACE] Language and framework: [LANGUAGE AND VERSION] The code that triggers it: [PASTE CODE] What I already tried: [ATTEMPTS] Explain what the error means in plain English, list the three most likely causes in order, show how to test each quickly and provide the corrected code for the most likely fix.
Include the exact error text and the smallest code snippet that reproduces it.
Get a better result
Your error explained in plain English, the three most likely causes in order with a quick test for each, and corrected code for the most likely fix.
Three ranked causes with a quick test each turns debugging into checking, not guessing. The “what I already tried” line saves time, because the model will not suggest fixes you have ruled out. Asking for plain English first means you learn what the error is telling you, which makes the next one easier.
You paste only the last line of the error.
Fix: Paste the full stack trace, as the tip says. The useful line is often the first one that points at your own file.
- The fix works but you do not know why. Ask it to explain which of the three causes it was and how the test proved it, so you can spot it next time.
- The suggested fix is for a different version. Give exact versions of the language and framework, and ask it to say if the fix depends on a version.
Ask it to help you cut your code down to the smallest snippet that still shows the error. Often the cause shows up while cutting.
The first fix did not work. I ran the quick test for cause two and got this: [PASTE RESULT]. What does it tell us?
More chat & writing prompts
See all 465 →More like this
- Kinder error messages for your appChatGPT · Gemini · Claude
- Senior engineer code review & debuggingAny chatbot
- Find the root cause from a stack traceClaude · ChatGPT · Gemini
- Track down a memory leakClaude · ChatGPT · Gemini
- Fix a layout bug from a screenshotClaude · ChatGPT · Claude Code



