← Back to AI Resources
🐛

AI Prompts for Debugging

Copy-paste prompts to fix bugs faster

These prompts are designed to get you better debugging help from AI. Replace the [bracketed text] with your actual code and error messages.

Error Messages

Explain This Error
I'm getting this error: [paste error message] In this code: [paste your code] Explain what's causing this error and how to fix it. Show me the corrected code.
Stack Trace Analysis
Here's my stack trace: [paste stack trace] Walk me through what each line means and identify where the actual problem is. What should I look at first?

Logic Bugs

Code Not Working As Expected
This code should [describe expected behavior], but instead it [describe actual behavior]. [paste your code] Find the bug and explain why it's happening.
Debug With Test Cases
This function fails on certain inputs: [paste function] Works: [example input that works] Fails: [example input that fails] What's the edge case I'm missing?

Runtime Issues

Infinite Loop Detection
This code seems to be running forever or hanging: [paste code] Find any infinite loops or recursive calls without proper exit conditions.
Memory/Performance Issue
This code is [slow / using too much memory / crashing on large inputs]: [paste code] Identify the performance bottleneck and suggest a more efficient approach.
Pro tip: Always include the actual error message, not just "it doesn't work." The more context you give, the better help you'll get.

Async/Promise Bugs

Async/Await Issues
I'm having issues with async code. The data is [undefined / coming back in wrong order / not waiting]: [paste async code] Check my async/await usage and promise handling. What am I doing wrong?
Race Condition Check
This code works sometimes but fails randomly: [paste code] Is there a race condition or timing issue? How do I make this reliable?