The prompt
I got this error:
[error]
From this code:
[code]
Explain the cause in plain English, then give the minimal fix. What it is
Explain this error is a short AI prompt with two placeholders, [error] and [code]. You paste in the error you received and the code that produced it. The AI is asked to explain the cause in plain English first, then give the minimal fix.
Who it's for
- Developers who hit an unfamiliar error message and want a plain-English explanation
- Beginners who find error messages and stack traces hard to read
- Anyone who wants a small targeted fix rather than a rewrite of their code
Requirements
Requirements
- An AI chat assistant to paste the prompt into
- The exact error message you received
- The code that triggered the error
Examples
Python TypeError
PromptI got this error:
TypeError: can only concatenate str (not "int") to str
From this code:
age = 30
print("I am " + age + " years old")
Explain the cause in plain English, then give the minimal fix.Expected output: A plain-English explanation that a string and an integer cannot be joined with +, followed by a minimal fix such as converting age to a string.
JavaScript undefined property
PromptI got this error:
TypeError: Cannot read properties of undefined (reading 'map')
From this code:
function List({ items }) {
return <ul>{items.map(i => <li>{i}</li>)}</ul>;
}
Explain the cause in plain English, then give the minimal fix.Expected output: An explanation that items is undefined when map is called, followed by a small fix such as defaulting items to an empty array.
SQL syntax error
PromptI got this error:
ERROR: column "total" does not exist
From this code:
SELECT customer_id, SUM(amount) AS total
FROM orders
WHERE total > 100
GROUP BY customer_id;
Explain the cause in plain English, then give the minimal fix.Expected output: An explanation that the alias total cannot be used in WHERE, followed by a minimal fix such as using HAVING SUM(amount) > 100.
Pros & cons
Pros
- Pro:Very short and easy to reuse
- Pro:Asks for a plain-English explanation, which helps with understanding the error
- Pro:Asks for the minimal fix, which keeps the answer focused
- Pro:Pairing the error with the code gives the AI the context it needs
Cons
- Con:Only two placeholders, so it has no field for language, framework or version
- Con:The source does not say how to handle multi-file problems or long stack traces
- Con:Output quality depends on the error and code you paste in
Tips
- Paste the full error message exactly as shown
- Include the code that triggered the error, not just a fragment with no context
- Keep the code section focused on the failing part
Variations
- Add the language or framework name before the error to give more context
- Ask for a short explanation of why the fix works, in addition to the fix