Explain This Error
Decode any error or stack trace: read it in the right direction, separate your code from framework noise, and fix the cause, not the symptom.
Explain this error and find the real cause.
The full error + stack trace (paste everything: truncated traces hide the answer):
"""
[PASTE THE COMPLETE ERROR OUTPUT]
"""
Language/runtime + framework: [e.g. "Python 3.12 / Django" / "Node 22 / Next.js"]
What I was doing when it happened: [THE ACTION/REQUEST/COMMAND]
What changed recently: [DEPLOYS, DEPENDENCY UPDATES, CONFIG, DATA, or "nothing I know of", which usually means environment drift]
Where it happens: [LOCALLY / CI / PRODUCTION ONLY / ONE MACHINE: "works on my machine" is a clue, not a complaint]
Work through it:
1. **Read the trace correctly for my language**: Python tracebacks: the throwing line is at the BOTTOM ("most recent call last"); JS/Java/C#: newest frame at the TOP, and in Java the real origin is the LAST "Caused by:" block, not the first exception shown. State which frame actually threw and quote it.
2. **Separate my code from the noise**: identify the deepest frame in MY code (vs framework/library internals). That frame plus the throwing frame bracket the problem; the framework frames between them are usually just the corridor.
3. **Name the mechanism, not just the message**: what state made this line throw given these inputs: the None/undefined that traveled from somewhere else, the type that changed shape, the resource that wasn't there. Distinguish the PROXIMATE cause (this line dereferenced null) from the ROOT cause (why was it null: the upstream contract that broke).
4. **Rank 2-3 root-cause hypotheses**: each with: the mechanism, what evidence in the trace/context supports it, and the single cheapest check to confirm or kill it (a log line, a REPL probe, one command). Use my "what changed" and "where it happens" answers: an error that only appears in one environment is an environment-difference problem wearing a code-error costume.
5. **The fix, at the right level**: the minimal change for the root cause, plus the symptom-level guard only if it's genuinely also warranted. Adding a null-check where the null should never have been is how codebases accumulate scar tissue. Say when that's what I'd be doing.
6. **The verification**: how I'll know it's actually fixed (reproduce → fix → re-run), and the regression test worth adding.
Rules: if the trace genuinely can't identify the root cause, say what's missing and ask for the specific output (the failing frame's local values, the request payload, the version diff) instead of guessing confidently. Never prescribe "just wrap it in try/catch" as a fix: swallowing the error is the anti-fix.How to use
Pasting an error at an AI is the single most common developer prompt, and the failure mode is symptom-level fixes: a null-check at the crash site while the root cause ships on. The direction rules (Python bottom-up, Java's last Caused-by) and the proximate-vs-root distinction are what a senior debugger does by reflex. The 'what changed / where it happens' inputs do more work than the trace itself for environment-specific bugs; don't skip them.
More coding prompts
Write the commit message for this change. Diff: """ [PASTE THE STAGED DIFF] """ Why I made this change: [THE REASON, THE TICKET, THE BUG REPORT, or "you infer it"] Convention: [Conventional Commits / this repo's existing style, pasted below / plain] Recent commits from this repo, to match style: """ [PASTE 5-10 RECENT COMMIT SUBJECT LIN
Commit Message
Write a commit message that explains why the change was made, in Conventional Commits format, split into separate commits when needed.
Help me recover from a git mistake without making it worse. What I was trying to do: [THE GOAL] What I ran: [THE EXACT COMMANDS, IN ORDER] What happened instead: [THE OUTPUT OR THE STATE NOW] Has this been pushed or shared: [YES/NO, and to which branch and whether anyone else has pulled] Uncommitted work I cannot lose: [WHAT AND WHERE, o
Undo a Git Mistake
Recover from a bad commit, force push, wrong branch, or lost work with a reversible plan and the exact commands, explained before you run them.
Handler code, routes, and models: """ [PASTE THE ROUTE DEFINITIONS, HANDLERS, REQUEST AND RESPONSE TYPES, VALIDATION SCHEMAS, AND MIDDLEWARE] """ Generate an OpenAPI 3.1 specification from the code above. API name, version, and base URL: [DETAILS] Auth scheme: [BEARER JWT / API KEY / OAUTH / SESSION COOKIE, and where it is enforced] Con
OpenAPI Spec From Code
Generate an accurate OpenAPI 3.1 spec from handler code, including error responses and auth, with gaps flagged instead of invented.