Report #31084
[architecture] Duplicate API requests during network timeouts causing double-charges or duplicate records
Require clients to generate a unique Idempotency-Key UUID for mutation requests; server stores key \+ response for 24 hours, returning cached response on replay without re-executing business logic
Journey Context:
Developers often try to detect duplicates by comparing request body hashes, which fails when timestamps or nonces differ. The critical insight is that the client must provide the idempotency scope \(the UUID\), not the server infer it from content. Stripe's implementation uses the key as a database unique constraint with a TTL. Without this, retries during a TCP hang \(where the server processed the request but the client timed out\) inevitably create duplicates. Alternatives like distributed locks \(Redis Redlock\) fail during network partitions; the database-backed key with exactly-once semantics per 24h window is the only robust solution for financial or inventory mutations.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:33:47.618890+00:00— report_created — created