Debug Error Messages & Find Fixes

Pinpoint likely causes and an action-oriented check sequence from pasted errors.

Prompt · 3 variables

I am working in {{execution environment}}, and execution stopped due to the error below. I am looking at this code for the first time today, so I am not yet familiar with the terminology.

Please explain what this error message means in plain English in one sentence, then list up to 3 likely causes ranked by probability. Do not assume or assert just one single cause.

For each candidate cause, provide step-by-step instructions on what I should check first. Write each step as an immediate, concrete action I can take right now (e.g., which file and line to inspect, what to log/print).

Format: Start with one sentence ("In short, this error means..."), followed by a table with columns: "Potential Cause | Evidence for this | How to Check | How to Fix". Finally, list 2–3 additional details I should provide if none of the three causes apply. Do not make up versions or configurations not mentioned in the provided snippet; if you need more information, specify what is missing.

Error Message: """ {{error message}} """

Relevant Code: """ {{relevant code snippet}} """

Copy, then paste here · ChatGPT and Claude open with the prompt filled in Open in ChatGPT ↗Open in Claude ↗Open in Gemini ↗ Edit in builder Download classroom card

Some variables here may contain personal data. Replace real names, numbers and company names with placeholders.

Why it is written this way

Context
I am working in {{execution environment}}, and execution stopped due to the error below. I am looking at this code for the first time today, so I am not yet familiar with the terminology.
Task
Please explain what this error message means in plain English in one sentence, then list up to 3 likely causes ranked by probability. Do not assume or assert just one single cause.
Steps
For each candidate cause, provide step-by-step instructions on what I should check first. Write each step as an immediate, concrete action I can take right now (e.g., which file and line to inspect, what to log/print).
Format
Format: Start with one sentence ("In short, this error means..."), followed by a table with columns: "Potential Cause | Evidence for this | How to Check | How to Fix". Finally, list 2–3 additional details I should provide if none of the three causes apply. Do not make up versions or configurations not mentioned in the provided snippet; if you need more information, specify what is missing.
Input
Error Message: """ {{error message}} """
Input
Relevant Code: """ {{relevant code snippet}} """

The most common mistake when asking ChatGPT to fix errors is copying and pasting only the red error text. The exact same message can stem from completely different root causes depending on the language and runtime version. Without knowing your environment, the AI will jump to a conclusion based on the most common scenario and suggest irrelevant fixes.

The Context paragraph prevents premature conclusions. Providing your framework, version, and OS stops the model from recommending configuration changes that don't apply to your stack. Adding that you are "looking at this code for the first time" also sets the right depth for the explanation.

In the Task, asking for "up to 3 causes ranked by probability" mirrors how real debugging works: by process of elimination. If you only ask for one cause and it's wrong, you have to start over; having three allows you to move immediately to the next candidate. The subsequent Step-by-step check sequence forces the AI to provide immediate actions rather than passive theoretical explanations.

The table in the Format section relies heavily on the "Evidence" column. Forcing the AI to cite evidence separates clues actually present in the stack trace from generic assumptions. Wrapping the pasted materials in """ delimiters is also critical: error logs often contain quotes, line breaks, and human-readable sentences that the AI might otherwise misinterpret as prompt instructions.

Asking for the relevant code snippet separately is intentional. An error message only shows where execution failed, not why a value was missing or undefined upstream. Supplying the lines flagged by the stack trace and surrounding context transforms generic troubleshooting into advice tailored to your actual codebase.

Unfamiliar terms? See Aha AI: prompt, hallucination

Compared with a bad example

Common bad example

Tell me why I'm getting this error

TypeError: Cannot read properties of undefined (reading 'map')

The AI assumes the single most common cause and immediately outputs replacement code. Because no source code was provided, the generated code uses placeholder names that don't match your project, and pasting it creates new errors. Without a systematic verification order, you won't know what to inspect next if the fix fails, forcing you to ask the same question again.

Variations

Silent Logic Errors (No Error Thrown)

Silent Logic Errors (No Error Thrown)

I am working in {{execution environment}}. No error is thrown, but the output does not match my expectations. Please trace how values flow step-by-step through the code below, and pinpoint where execution diverges from the expected result. Include what values each variable should hold at each step.

""" {{relevant code snippet}} """

Use this when your code fails silently without crashing. When there is no stack trace, tracing the value flow is the only reliable clue.

Obscure Errors with No Search Results

Obscure Errors with No Search Results

Please extract 3 key search queries from the error message below. Remove any project-specific details such as custom paths and project names so that only the relevant library names and error types remain. Add a one-line explanation for what type of results each query is designed to find.

""" {{error message}} """

Use this to search effectively when AI explanations are insufficient. Queries containing local file paths won't return useful public search results.

Model notes

If the error message contains local file paths, internal IP addresses, or proprietary server names, sanitize or remove them before pasting.

Related prompts

Last updated 2026-09-02 · Found a mistake? Let us know