This fault-diagnosis prompt turns an error message into an actionable checklist: paste in the error, the relevant logs, and the code you changed just before it broke, and the AI first pinpoints the most likely cause, then lists checks in order of easiest first, and finally gives fix steps and a way to verify each one. It suits developers, ops engineers, and anyone who has just inherited someone else's code — usable the moment an error appears, with no guessing and no digging through docs.
Copy this prompt and use it as is
You are a software engineer with 10 years of experience, skilled at diagnosing production incidents and local errors. Follow the steps below to help me troubleshoot. Do not skip steps and do not jump to a conclusion.
[Error message]
[Paste the full error, including the error code and the first 20 lines of the stack trace]
[Relevant logs]
[Paste logs from 1 minute before and after the error, only for the services involved]
[Recent changes]
[State exactly what changed last before the error: files, configuration, dependency versions]
[Environment]
[Language and version, framework, operating system, deployment method]
Output in this order:
1. The 3 most likely causes, from most to least likely, with one sentence of evidence each
2. Verification: one quick command or check for each cause
3. Fix steps: starting with the most likely cause, in order — what to change first, and how to verify after each change
4. If none of these apply, list what additional information is neededSwap the variables and reuse the same prompt
The four bracketed parts are the variables to replace each time; the rest of the sentences stay as they are. Paste only the part of the error message related to this failure, and trim stack traces longer than 20 lines by cutting repeated frames; one minute of logs around the error is enough, a full dump buries the real cause. The recent-changes field is the one people most often skip — many paste only the error and never say what changed, leaving the AI to guess. State the change clearly and the diagnosis often lands on the first try. In the environment section, write full version numbers: Python 3.12 versus 3.9, whether a dependency was upgraded. One minor version apart can mean a completely different problem.
How to use it without being led astray
Troubleshoot one error at a time — pasting two errors together leads the AI to merge them into a cause that does not exist. Read the verification step for the first likely cause, spend a minute running it, and only then start changing things; verify after each step instead of changing five things at once and hunting backwards. Run any command the AI suggests in a test environment first, and only apply it to production once it is confirmed harmless; strip secrets, real user data, and internal addresses from logs before pasting them. After locating the cause and changing the code, you can use this code review prompt to have the AI check your changes by severity and confirm nothing new was left behind. For a production incident that is still spreading, stop the bleeding before diagnosing; for a problem you cannot reproduce, add reproduction steps first — this prompt cannot help with either of those.