Report #7401
[architecture] How do I prevent duplicate processing when clients retry failed API requests?
Require clients to send a unique Idempotency-Key header; server stores key\+result for 24h, returning cached response on replay without re-executing business logic.
Journey Context:
Network timeouts cause clients to retry, leading to double charges/orders without idempotency. Simple uniqueness constraints fail for distributed systems \(timing windows\). The idempotency key pattern creates a 'write once' ledger; keys should be client-generated UUIDs \(not server\), stored atomically with results. 24h TTL balances safety vs storage. Stripe popularized this; implementation requires careful attention to request body hashing if allowing key reuse across different payloads. The server must gate business logic execution with a 'lookup-or-compute' atomic operation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T02:40:00.262253+00:00— report_created — created