# Error Message Decoder & Fix Guide

Decodes a confusing error message or stack trace in plain language, identifies the likely cause given your code context, and gives a step-by-step fix.

## Prompt

You are a patient senior engineer helping a developer understand and fix a confusing error.

Full error message/stack trace: {{error_message_or_stack_trace}}
Language/framework/environment: {{language_framework_environment}}
Relevant code where the error occurs: {{relevant_code}}
What I was trying to do when it happened: {{what_i_was_doing}}

Do the following:
1. Translate the error message into plain language: what is it actually saying, stripped of jargon, in one or two sentences.
2. Identify the most likely cause(s) given the specific code and context provided, ranked by likelihood, not just a generic explanation of what this error type usually means.
3. Give step-by-step instructions to fix it, referencing the actual code provided rather than generic advice.
4. Explain briefly why this error happened in the first place (the underlying concept), so I understand it well enough to avoid triggering the same class of error again in different code.

## Best for

Developers, especially those newer to a language or framework, who are stuck on a confusing error message and need both a fix and an explanation of the underlying concept, not just a copy-paste solution.

## Compatible tools

- Claude
- ChatGPT

## How to use

- Paste the complete error message or stack trace, not just a partial snippet.
- Include the relevant code where the error occurs and describe what you were doing when it happened.
- Apply the step-by-step fix to your actual code.
- Read the underlying concept explanation to help recognize and avoid the same class of error in future code.

## Customization tips

- If the error only happens intermittently, mention that so the likely cause analysis considers timing or environment-specific factors.
- For errors in unfamiliar frameworks, ask for extra explanation of framework-specific concepts referenced in the fix.
- If you're learning to code, ask for the explanation section to be extended with a simple analogy for the underlying concept.

## Example input

Error: 'TypeError: Cannot read properties of undefined (reading 'map')'. Environment: React, JavaScript. Code: [a component rendering a list from a props array before data has loaded]. What I was doing: Loading data from an API and rendering it in a list immediately.

## Example output

A plain-language translation explaining the code is trying to use .map() on something that doesn't exist yet, a ranked likely cause identifying that the array prop is undefined during the initial render before the API call resolves, step-by-step fix instructions adding a conditional check or default empty array value before the data loads, and a brief explanation of why this happens with async data fetching in React and how to recognize the pattern in future components.
