Debugging errors
Send GPT-6.2 Sol the error and the few lines of code around it, and have it name the cause, the smallest fix, and how to verify it. Still run the tests after the change.
Example: Why does the list page throw undefined?
Material
- Error
- TypeError: Cannot read properties of undefined (reading 'name')
- list.tsx
- items.map((item) => item.owner.name)
- API response
- Some records have no owner field.
PromptFrom the error and the code, name the cause, give the smallest change that fixes it, and explain how to confirm it’s fixed.
Sample answer · written by hand to show the reasoning
Some records are missing owner, so reading owner.name throws. Change it to item.owner?.name ?? "Unassigned", then render the list with a record that has no owner and confirm the page shows “Unassigned” without an error.