Report #82969
[architecture] Retrying failed API requests creates duplicate charges, orders, or side effects
Generate a UUID idempotency key client-side for mutation requests; send in Idempotency-Key header; server locks key for 24h and returns cached response on duplicate
Journey Context:
Network failures force retries, but without idempotency, a 'Pay $100' request processed twice charges $200. The client must generate a unique key \(UUIDv4\) before the first attempt and send it with every retry. The server stores the key→response mapping in a short-term cache \(Redis/DB\) with TTL \(usually 24h\). Critical: the server must check this atomically before starting transaction processing to avoid race conditions. Keys should be scoped to the user/resource to prevent collisions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T21:51:20.322415+00:00— report_created — created