Debug by Pasting the Error, Not the Vibe
What it is
Why it works
The error text is the single most information-dense clue you have. Paraphrasing it throws that away and forces ChatGPT to guess, which is where confident wrong fixes come from.
When to use it
Every time you have an actual error, exception, or failing test. The more literal the paste — exact message, line numbers, versions — the sharper the fix.
When not to use it
When there is no error and the problem is 'the output is subtly wrong', pasting a trace won't help — there describe the expected vs actual behaviour with examples instead.
Prompt
This fails. Here is the exact error and a minimal reproduction.
Error:
<paste full message + stack trace>
Code:
<smallest snippet that reproduces it>
Environment: <language/runtime + versions>.
Explain the root cause first, then give the minimal fix. Don't rewrite unrelated code.Example
Pasting a full TypeError trace plus the six lines around it, ChatGPT pinpoints an off-by-one on line 3 and returns a two-character fix — no rewrite of the surrounding module.
Advanced version
Ask ChatGPT to first state what the error means in general, then map each part of the trace to your code. Understanding beats a patch you can't defend later.
Common mistakes
- Retyping the error from memory and dropping the part that mattered.
- Pasting 400 lines of context instead of a minimal reproduction.
- Applying the fix without asking why it failed, so the next instance surprises you too.