Report #63559
[architecture] Implementing safe retries for distributed API calls without duplicate side effects
Generate a unique idempotency key \(UUID\) client-side and send it in a dedicated header; the server must persist the key with the response state for at least 24 hours, atomically checking for existence before executing business logic, and returning the cached response for duplicates.
Journey Context:
The common failure is retrying POST requests on network timeouts without idempotency keys, leading to double-charges or duplicate records. Client-side deduplication is insufficient because the request may succeed server-side while the response is lost to a network partition \(the 'distributed system timeout problem'\). The server must persist the key before acknowledging, accepting a small latency/storage cost for correctness. Alternatives like natural idempotency \(PUT with client-generated IDs\) work for updates but not resource creation where the client cannot predict the final ID.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T13:10:27.856583+00:00— report_created — created