Skip to content
CodingBeginner

Explain This Error and Suggest a Fix

Get a plain-English explanation of an error plus a concrete next step, not just a fix.

Prompt

I'm getting this error while working in {{language_or_framework}}:

{{error_message}}

Here's the relevant code:
{{code_snippet}}

Explain in plain English what's causing this error, then suggest a fix. If there's more than one likely cause, list them in order of likelihood.

Fill in these placeholders

  • {{language_or_framework}}
  • {{error_message}}
  • {{code_snippet}}

How to use it

Include the exact error message and only the relevant code, not your entire file — shorter, focused context usually gets a more accurate answer.

Example use case

Debugging an unfamiliar error message while learning a new language or framework.

Why this prompt works

Asking for an explanation before a fix is the whole point. A fix you do not understand is a fix you cannot verify, and error messages are one of the few places where the underlying cause is genuinely learnable. Supplying the surrounding code and what you already tried also stops it suggesting the thing you did five minutes ago.

What good output looks like

A plain explanation of what the error means, a specific cause tied to your code, and a fix you can follow the logic of. If the explanation is generic boilerplate about the error type, it has not read your code properly — give it more context and ask again.

Common mistakes

  • Pasting the error without any surrounding code, which forces it to guess at context and guess wrongly.
  • Not saying what you already tried, so the first suggestion is often something you have already ruled out.
  • Applying the fix without reading the explanation, which converts a learning moment into a mystery that will repeat.

Variations worth trying

  • Add 'explain what this error means in general, not just in my code' to make the knowledge transfer to next time.
  • Ask for the two most likely causes ranked, rather than one answer stated confidently.
  • Ask what you could add — a log line, a check — that would tell you which cause it actually is.

Tools this works well in

Want to write prompts like this yourself? Prompt Engineering for Real Work covers the structure behind every template here — free, no sign-up.