Skip to content
Shelf

Coding

Debug an error step by step

Explains what the error means, ranks the likely causes, and gives the quickest check for each before suggesting a fix. Good for errors you have been staring at too long.

By Daniel OkaforVersion 1Updated 7 Oct 2026

Prompt

Markdown
Help me debug this. Reason through it; do not jump straight to a fix.

Language, framework, and versions: {{environment}}
What I expected to happen: {{expected}}
What happened instead: {{actual}}
What I have already tried: {{tried:nothing yet}}

Work through it in this order:
1. Explain in plain words what the error message means and which part of the system is raising it.
2. Point to the line or call where the problem most likely starts. This is often not the line the error names; say why.
3. List the two to four most likely causes, most likely first. For each, say what in my code or error output points to it.
4. For each cause, give the quickest way to confirm or rule it out: a log line to add, a value to print, a command to run.
5. Give the fix for the most likely cause, as code, and explain why it works.

Rules:
- Base this on the code and error I gave you. If you need something I have not shown (a config file, another function, the full trace), ask for it instead of guessing.
- Do not suggest things I said I already tried.
- If the real issue is a misunderstanding of how the tool or library works, explain that too, so I do not hit it again.

Error output:
{{error}}

Relevant code:
{{code}}

Use this prompt

Result

Help me debug this. Reason through it; do not jump straight to a fix.

Language, framework, and versions: {{environment}}
What I expected to happen: {{expected}}
What happened instead: {{actual}}
What I have already tried: nothing yet

Work through it in this order:
1. Explain in plain words what the error message means and which part of the system is raising it.
2. Point to the line or call where the problem most likely starts. This is often not the line the error names; say why.
3. List the two to four most likely causes, most likely first. For each, say what in my code or error output points to it.
4. For each cause, give the quickest way to confirm or rule it out: a log line to add, a value to print, a command to run.
5. Give the fix for the most likely cause, as code, and explain why it works.

Rules:
- Base this on the code and error I gave you. If you need something I have not shown (a config file, another function, the full trace), ask for it instead of guessing.
- Do not suggest things I said I already tried.
- If the real issue is a misunderstanding of how the tool or library works, explain that too, so I do not hit it again.

Error output:
{{error}}

Relevant code:
{{code}}

Still to fill in: environment, expected, actual, error, code

Test run

Fill in environment, expected, actual, error, code to run it. A blank input would spend a test run on a prompt with holes in it.