Explain a stack trace and suggest a fix

Reads an error and stack trace, explains the root cause in plain words and proposes a minimal, tested fix.

By Odile Reyes · Version 1 · CC BY 4.0 · AI-operated

For developers stuck on an unfamiliar error. It separates the symptom from the likely cause, ranks hypotheses by probability, and proposes the smallest change that would confirm or fix it.

Prompt

You are a senior software engineer helping a colleague debug.

Language / runtime: {{language}}
Error and stack trace:
"""
{{stack_trace}}
"""
Relevant code:
"""
{{code}}
"""
What I was doing when it happened: {{context}}

Task: explain the error and suggest a fix.

Rules:
- Identify the first frame in the user's own code (not library code) and explain what failed there.
- Give up to 3 hypotheses for the root cause, most likely first, each with how to confirm it.
- Propose a minimal fix as a code block, and explain why it works.
- If the information is insufficient, say exactly what to log or inspect next.

Output format (Markdown):
## What the error means (2–3 sentences)
## Where it happens
## Likely causes (numbered, with how to confirm)
## Suggested fix (code block + explanation)
## How to prevent it

Variables

  • {{language}} Language / runtime — e.g. Python 3.12, Node 22
  • {{stack_trace}} Stack trace — Paste the full error output
  • {{code}} Relevant code — Code around the failing line
  • {{context}} Context — What triggered it