Skip to content
← Back to Articles
AI

Debugging With AI: How to Describe a Bug So You Get a Useful Answer

"It doesn't work, please fix" rarely gets a good answer from an AI assistant. A well-described bug often gets solved on the first try. Here's how to describe one.

Paperskeep
Paperskeep
Dec 04, 2026 · 3 min read

When you're stuck on a bug, it's tempting to paste a chunk of code into an AI assistant with a desperate "why doesn't this work?". Sometimes you get lucky. More often you get a plausible guess that sends you down the wrong path.

The quality of the answer depends heavily on the quality of the bug report. Here's how to write one that gets results.

Describe expected vs actual

Every good bug report starts with two sentences:

  • Expected: what should happen
  • Actual: what happens instead

"The total should be $45.50 but shows $4550" points straight at a units or formatting problem. "The total is wrong" points nowhere.

Include the exact error

Copy the full error message and stack trace, not a summary of it. The file names, line numbers and error types are clues. Paraphrasing them throws the clues away.

A precise question is half of the answer.

Show how to reproduce it

Explain the steps that trigger the bug:

  1. Start the app with an empty cart.
  2. Add an item that has a discount.
  3. Click checkout.

If you can't reproduce it reliably, say so, along with what makes it more or less likely. Intermittent bugs often point to timing, caching or shared state.

Share the right code, not all of it

Pasting a whole project overwhelms the conversation. Pasting one line hides the context. Aim for:

  • The function where things go wrong
  • The code that calls it
  • Any relevant data structures or configuration

If you use a coding agent that can read your project directly, point it at the relevant files and let it look around rather than pasting everything.

Mention what you've already tried

"I already checked that the API returns the right value" saves the assistant from suggesting that first. It also nudges it toward less obvious causes.

Ask for hypotheses first

Instead of asking for a fix straight away, try:

"List the three most likely causes, and tell me how to confirm each one."

This keeps you in the driver's seat. You test the hypotheses, you learn what actually went wrong, and you avoid applying a "fix" that hides the symptom instead of solving the cause.

Verify the fix

When you get a fix:

  • Make sure you understand why it works.
  • Check that the original bug is gone using your reproduction steps.
  • Run your tests to catch anything the fix broke.
  • Consider adding a test so the bug can't quietly return.

A template you can reuse

Expected: … Actual: … Error: (full message) Steps to reproduce: … Relevant code: … Already tried: …

Keep it in a note and fill it in whenever you get stuck.

The takeaway

AI assistants are strong debugging partners when they have good information. Describe the bug the way you'd describe it to a senior colleague, ask for hypotheses before fixes, and always verify. You'll spend less time chasing wrong answers and more time fixing the right problem.

Enjoyed this piece?

Get the next one in your inbox, every other Friday.

More from Paperskeep