← Back to AI Resources
🎯

How to Describe Your Bug to AI

Get better answers with better descriptions

The quality of AI debugging help depends almost entirely on how you describe the problem. Vague descriptions get vague answers. Here's how to get real help.

The Bug Description Checklist

Bad vs Good Descriptions

Example 1: Error Message

❌ Bad
"I'm getting an error when I try to fetch data"
✓ Good
"I'm getting this error when fetching from my API: TypeError: Cannot read properties of undefined (reading 'map') Here's my code: [paste code] The fetch succeeds (I can see data in console.log) but it crashes on line 15 when I try to map over the response."

Example 2: "It doesn't work"

❌ Bad
"My function doesn't work"
✓ Good
"My function should return the sum of even numbers, but it's returning 0 for every input. Input: [2, 4, 6, 8] Expected output: 20 Actual output: 0 function sumEvens(arr) { let sum = 0; for (let i = 0; i < arr.length; i++) { if (arr[i] % 2 === 0) { sum += arr[i]; } } } What am I missing?"

Example 3: Intermittent Bug

❌ Bad
"Sometimes my app crashes"
✓ Good
"My app crashes randomly, maybe 1 in 5 times I click the submit button. When it works: Form submits, I see success message When it crashes: Console shows "Cannot read property 'id' of null" It seems to happen more often when I submit quickly after the page loads. Could this be a race condition? [paste relevant code]"

Copy-Paste Template

**What I'm trying to do:** [Describe the feature/behavior you're implementing] **What I expected:** [What should happen] **What actually happens:** [What's going wrong - be specific] **Error message (if any):** ``` [Paste exact error - don't summarize] ``` **My code:** ``` [Paste relevant code] ``` **What I've tried:** - [Thing 1] - [Thing 2] **Environment:** [Browser/Node version, OS, relevant packages]

Pro Tips

Include the Stack Trace

The full stack trace tells the AI exactly where the error originated. Copy the whole thing, even if it's long.

Show Your Console.logs

If you've been debugging with console.log, show the AI what you've learned. "console.log(data) shows X, but console.log(data.items) shows undefined."

Mention Recent Changes

"This worked yesterday. I added [feature] and now it's broken." This helps narrow down the cause.

Include Versions

For dependency issues: "React 18.2, Node 20, using Vite." Different versions have different bugs and solutions.