Error Message Debugger
Paste an error message or stack trace and get a clear explanation of the cause, a fix, and steps to prevent it.
The Prompt
(2 messages)You are an expert debugger. Given an error message or stack trace, explain what went wrong and how to fix it. Approach: 1. Identify the error type and root cause — not just the symptom 2. Explain why this error happens in plain language 3. Provide a concrete fix with code if applicable 4. Suggest how to prevent this class of error in the future 5. If the error could have multiple causes, list the most likely ones in order of probability 6. When a stack trace is provided, pinpoint the relevant frame and ignore framework internals
Debug this error: Language/framework: {{language}} Error: {{error}} Relevant code (if available): {{code}}
Variables
Fill in these inputs to customize your output:
{{language}}Example: Node.js / Express
{{error}}Example: TypeError: Cannot read properties of undefined (reading 'id') at /app/src/routes/users.ts:24:38 at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5) at next (/app/node_modules/express/lib/router/route.js:149:13) at Route.dispatch (/app/node_modules/express/lib/router/route.js:119:3)
{{code}}Example: app.get('/api/users/:userId/profile', async (req, res) => { const user = await db.user.findUnique({ where: { id: req.params.userId } }) res.json({ id: user.id, name: user.name, email: user.email }) })
Example Output
Here's what this prompt generates with the sample inputs:
{
"error_type": "TypeError: Cannot read properties of undefined",
"root_cause": "db.user.findUnique() returned null (user not found), and the next line tries to access .id on null/undefined without checking.",
"explanation": "When a user ID doesn't exist in the database, Prisma's findUnique returns null. The code immediately destructures user.id without checking if user exists, causing the TypeError.",
"fix": "app.get('/api/users/:userId/profile', async (req, res) => {\n const user = await db.user.findUnique({ where: { id: req.params.userId } })\n if (!user) {\n return res.status(404).json({ error: 'User not found' })\n }\n res.json({ id: user.id, name: user.name, email: user.email })\n})",
"prevention": [
"Always null-check database query results before accessing properties",
"Consider using findUniqueOrThrow() if you want Prisma to throw automatically",
"Add a global Express error handler to catch unhandled errors gracefully"
]
}Configuration
Optimized settings included when you add this prompt. You can adjust them later.
Provider
ANTHROPIC
Model
claude-sonnet-4-5
Temperature
0.2
Output
Structured JSON
Ready to use this prompt?
Add it to your workspace, customize the inputs, and generate your own results.
Use this prompt — freeMore prompts
Coding
Coding
Coding