Skip to content

Debugging

Track down a bug that only happens sometimes

It fails one time in ten, and every fix seems to work until it doesn’t.

What you get
The conditions that make it fail, a way to trigger it on demand, then a fix.
Paste it into
Your AI tool, in your project
The prompt
This bug only happens sometimes: [describe it].

Don't propose a fix yet. First work out what could vary between a good run and a bad one: timing and the order two requests finish in, double clicks, a slow or failed network call, leftover state from a previous action, time of day, or data that only some records have.

For the most likely causes, find a way to force the failure every time, for example by adding a delay or sending the same request twice. Once you can trigger it reliably, show me. Then fix the cause and run the same trigger again to prove it's gone.

Use it

Open your AI tool (Claude Code, Codex or Cursor) in your project folder and paste it in. Replace the parts in [brackets] with your own details first.

More in Debugging