Skip to main content
Debug

Debug an error without shotgun changes

Give Gemini the error, the reproduction, and the relevant code, then ask for the most likely root cause, a minimal fix, and how to confirm it — before touching anything else.

The prompt

Here is a bug. Symptom: [SYMPTOM]. Reproduction: [STEPS]. Relevant code: [CODE/FILES]. Identify the most likely root cause with reasoning, propose the minimal fix, and tell me how to confirm it works. Do not suggest unrelated refactors. If you are unsure, list what to check next.

Replace the variables

[SYMPTOM]

Exact error text or wrong behaviour.

[STEPS]

How to reproduce.

[CODE/FILES]

The smallest slice that contains the bug.

Which model to use

  • Gemini 3.1 ProRoot-cause reasoning over multiple files is stronger on Pro.

Example input

  • [SYMPTOM] = "TypeError: cannot read property id of undefined on checkout".

Example output

We only publish example outputs from real model runs. This template has not been formally tested yet, so no output is shown. Run it yourself with the input above.

Why this structure works

  • Anchoring on reproduction keeps the model from guessing in the dark.
  • Banning unrelated refactors keeps the diff small and reviewable.

Common failures & fixes

It guesses without the real code.

Fix: Paste the actual failing function and stack trace.

Known limitations

  • Confirm the fix by reproducing the bug first, then re-running.

Not affiliated with or endorsed by Google. Gemini, Nano Banana, and Veo are trademarks of Google LLC.