Report #97202
[architecture] How do I make a network request safe to retry without double-charging or duplicate side effects?
Require clients to send an Idempotency-Key header \(a UUID generated client-side\) for any state-changing request that might be retried. The server stores the key with the response for 24 hours and replays the stored response on duplicate submissions, never re-executing the handler.
Journey Context:
Retries are inevitable over unreliable networks, but naive retries create duplicates. People often try to make operations unique with composite natural keys or database upserts, but that fails for requests that span multiple systems or have non-idempotent third-party effects \(charges, emails, shipments\). The idempotency-key pattern separates the intent \(the key\) from the execution: the key is the single source of truth for 'has this exact request already been processed?' Store it atomically with the outcome, return cached outcomes, and reject keys that are still in flight. It adds a small persistence cost and forces clients to generate and preserve keys across retries, but it is the only robust answer for distributed mutations.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-25T04:43:31.143861+00:00— report_created — created