← Back to AI Resources
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
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.
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
This code should [describe expected behavior], but instead it [describe actual behavior].
[paste your code]
Find the bug and explain why it's happening.
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
This code seems to be running forever or hanging:
[paste code]
Find any infinite loops or recursive calls without proper exit conditions.
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
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?
This code works sometimes but fails randomly:
[paste code]
Is there a race condition or timing issue? How do I make this reliable?