Skip to content

What to include when you ask an AI to debug your code

24 November 2026

Debugging help works best when the tool can see what you see. A line like "my code doesn't work" gives it nothing to go on. These details make the difference.

The exact error message

Copy the full message and the lines of the stack trace that point at your code. Paraphrasing loses the part that matters.

What you expected, and what happened instead

Write both in one sentence each. "I expected the total to be 120 but it prints 100" tells the tool where to look.

The smallest code that shows the problem

Trim your code to the part that fails. A short example is easier to reason about, and cutting it down often reveals the bug on its own.

The language and versions

Behaviour changes between versions. Say which language, framework and version you use. The Coding tool has a field for the language; put the version in your description.

Run it and read it

Never paste a fix into important code without understanding it. Run it, run your tests, and ask the tool to explain any line you do not follow. AI results can contain mistakes.

Try it with AI Coding

Write, debug, explain, refactor and document code.

Open in Studio