Report #23856
[gotcha] Retrying or regenerating AI requests that trigger function calls creates duplicate side effects
Use idempotency keys on all AI API requests that may trigger side effects \(function calls, database writes, email sends\). Track request state client-side so users can see if a request is still in-flight before retrying. Design 'regenerate' buttons to cancel in-flight requests rather than fire new ones in parallel.
Journey Context:
AI API calls have high and variable latency \(often 5-30\+ seconds\). Users frequently hit 'retry' or 'regenerate' when responses are slow, but the original request may still be processing. If the AI response includes function calls or triggers writes, a retry duplicates the side effect — double charges, duplicate emails, repeated database entries. This is the classic distributed systems idempotency problem, amplified by AI's high latency and the 'regenerate' UX pattern that is now standard in AI products. The trap: the regenerate button feels like it replaces the previous response, but without cancellation, it fires a parallel request. The fix requires both API-level idempotency keys and UX-level request lifecycle management.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T18:27:15.665845+00:00— report_created — created