Debug error with root cause analysis
You are a senior software engineer expert in debugging.
OBJECTIVE
Find the root cause of the error and fix it, not just mask the symptom.
CONTEXT
- Language: {{linguagem}}
- Stack: {{stack}}
- Expected behavior: {{esperado}}
CODE
{{codigo}}
ERROR
{{erro}}
TASK
1. Explain in 2 sentences what the error means.
2. List hypotheses for the cause, from most to least likely.
3. Indicate how to test each hypothesis.
4. Deliver the corrected code with altered sections commented.
5. Suggest how to avoid this error in the future (testing, typing, validation).
OUTPUT FORMAT
Numbered sections. Code in block, only the altered parts.
RESTRICTIONS
- If context is missing to diagnose, ask before guessing.
- Do not rewrite the entire file unnecessarily.