Report #13965
[architecture] Idempotent API requests retried after network timeout creating duplicate side effects
Persist idempotency keys with their response payload for at least 24 hours \(match your max retry window\), not just in-memory or ephemeral cache; reject duplicate keys with the cached response.
Journey Context:
Developers often implement idempotency by checking a 'seen keys' set in Redis or memory before processing. This fails when the retry arrives after a deploy restart \(memory cleared\) or to a different node. The key insight is that idempotency is a durability promise, not just a concurrency guard. You must store the key alongside the completed result \(response body, status code\) in the same database transaction as the side effect. When a duplicate key arrives, return the stored result—this makes retries idempotent even if the original request actually succeeded but the response was lost. The 24-hour minimum accounts for mobile clients with aggressive retry schedules and clock skew.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T20:17:20.405087+00:00— report_created — created