
- Updated
Find the root cause from a stack trace
This prompt makes the AI read your stack trace from the bottom up and find the line that really causes the failure, not just where it crashes. Paste the full trace, the code it points to and what you expected to happen.
Act as a senior [LANGUAGE, e.g. Python / Django] developer helping me debug. Error and full stack trace: [PASTE THE STACK TRACE] The code it points to: [PASTE THE RELEVANT FILE OR FUNCTION] What I expected to happen: [EXPECTED, e.g. the order saves and returns 201] Walk the trace from the bottom up and tell me which line actually causes the failure, not just where it crashes. Give the most likely root cause, one or two other possible causes, a minimal fix as a code diff, and one check I can run to confirm the fix worked.
Paste the whole trace, not only the last line. The real cause is often a few frames above the crash.
Get a better result
The line that truly causes the failure, found by reading the trace from the bottom up, plus the most likely root cause, one or two other causes, a minimal fix as a code diff and one check to confirm it worked.
You paste only the last line of the error.
Fix: Paste the whole trace, as the tip says. The real cause is often a few frames above the crash.
- The fix changes much more code than needed. Add “smallest possible change, touch only the lines involved, no refactoring”.
- It guesses about code it cannot see. Paste the file or function named in the trace and say “if you need another file, ask for it instead of guessing”.
Ask “then write one failing test that reproduces this error, and show that it passes after the fix”. A test helps keep the bug from coming back.
Here is the exact error I got when I ran it. Explain the cause in one line, then show only the code that needs to change:
Guides that use this prompt
More chat & writing prompts
See all 465 →More like this
- Senior engineer code review & debuggingAny chatbot
- Write a blameless incident postmortemChatGPT · Gemini · Claude
- Fix a flaky test that passes and fails at randomClaude · ChatGPT · Gemini
- Debug an error message step by stepChatGPT · Gemini · Claude
- Add logging that helps you debug laterClaude · ChatGPT · Gemini



