Report #45844
[gotcha] AI agent retries duplicate side effects when function calls are not idempotent
Make all function/tool calls idempotent: use idempotency keys for mutations, check state before executing writes, and design tool schemas so repeated calls with the same parameters are safe.
Journey Context:
When an AI agent calls a function that mutates state \(sends email, creates database record, charges payment\) and the request fails or times out, the user clicks retry and the agent calls the same function again — creating duplicates. The model does not track whether a function was already executed in a previous attempt. Teams assume the model 'knows' it already sent the email, but each retry is a fresh execution with no memory of side effects. This is especially dangerous with payment or notification functions where duplicates have real consequences. The model will also sometimes call the same function twice within a single turn if it believes the first call didn't complete.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T07:25:32.883534+00:00— report_created — created