Failure pattern · 1 documented incident
Duplicate action after an ambiguous result
A request times out, the caller assumes it failed and retries, and the money moves (or the order ships) twice.
See it happen
Watch how this failure unfolds, then switch to the same situation with the safeguard in place. Tap or click any step to replay it.
Scroll the diagram sideways to see every system.
Ana is refunded twice, and every further retry would pay again.
What goes wrong:
- The agent asks the payments API to refund Ana $50.
- The money moves, but the reply is lost on the way back.
- Assuming the refund failed, the agent sends it again.
- Ana is refunded twice, and every further retry would pay again.
With the safeguard:
- Each refund carries a unique idempotency key.
- The reply is lost again.
- The retry reuses the same key, so the API recognises it and returns the first result.
- One refund, no matter how many retries.
What it is
A request that changes something (a payment, an order, a message) times out. The caller can’t tell whether it worked, assumes it didn’t, and sends it again. The first one had gone through, so now it happens twice.
How it happens
- Your system calls a payments, messaging or provisioning API that it doesn’t control
- The network drops or a gateway returns 502/504 after the other side has already done the work
- Retry logic resends the request with nothing that marks it as the same request
What it causes
- Customers charged, refunded or paid twice
- Orders shipped twice, tickets or seats allocated twice
- Your ledger and the provider’s records drift apart
Warning signs
- Two transactions for what the customer meant as one action
- Bursts of client timeouts immediately followed by success responses
- Order status in your database disagrees with the payment provider
How to prevent it
Make every consequential call idempotent. Send a client-generated idempotency key with each state-changing request, treat timeouts as "unknown" rather than "failed", and check the remote status before retrying.
- Every request that moves money or changes state carries a unique idempotency key
- A timeout is treated as “unknown”, not as “failed”
- Before retrying a consequential action, the system checks what actually happened
Key ideas:Idempotency key
How to verify
Use synthetic data in an isolated test environment. These checks are engineering guidance; a checkmark is your team’s assessment.
1. Try: Submit the same state-changing request twice with one idempotency key, including concurrent retries.
Pass when: Exactly one side effect occurs. Completed retries resolve the original outcome; in-flight retries wait or report an in-progress state without repeating the action.
2. Try: Complete the remote action but drop its response, then retry after the client times out.
Pass when: The caller resolves the existing operation instead of repeating it.
Evidence to keep: Keep the request IDs, idempotency key, returned outcomes and count of resulting side effects.
Real incidents with this pattern
Documented incidents first. Each links to its public source.
Design reference: idempotency keys make retried payment API calls safe (Stripe)
Stripe explains that a client which cannot tell whether a request succeeded (for example after a network failure) needs to retry safely, and that without protection a retried charge could double-charge a customer.
Safeguard: Attach idempotency keys to state-changing requests
More records with this pattern5 security advisories · 8 illustrative scenarios
Showing 12 of 13. See all records with this pattern
Zipline issue could cause actions to run with inconsistent state
Zipline before 4.8.0 contains a race condition vulnerability in src/server/routes/raw/[id].ts that allows remote attackers to bypass file maxViews limits through non-atomic view counting.
Windows DHCP Server issue could cause actions to run with inconsistent state
Time-of-check time-of-use (toctou) race condition in Windows DHCP Server allows an authorized attacker to execute code over a network.
bitcoinjs-lib: Undetected merkle node duplication in block root computation validates a forged transaction list
fastMerkleRoot pads an odd level by hashing the last node with itself. It does not report that it did so, and checkTxRoots never looks for repeated transactions.
Incorrect authorization due to a time-of-check to time-of-use (TOCTOU) race condition in the setACL request…
Incorrect authorization due to a time-of-check to time-of-use (TOCTOU) race condition in the setACL request handling of Apache ZooKeeper.
WordPress Core issue could cause actions to run with inconsistent state
WordPress WordPress Core contains a time-of-check time-of-use (TOCTOU) race condition vulnerability that could allow unauthenticated attackers to execute code on the server during the upgrade window.
Autonomous AI Agent Model Context Protocol Token Hijacking
Model Context Protocol search tool allowed prompt injection to leak bearer tokens in subagent prompt context.
JWT Secret Key Confusion & Privilege Escalation
Backend accepted HMAC-SHA256 tokens signed with public RSA key, allowing attacker to forge administrator tokens.
Distributed Rate Limiter Redis Key Collision & Global Lockout
Missing tenant namespace prefix in rate limiter Redis key caused single user limit to apply globally to all tenants.
OAuth Refresh Token Reuse Race Condition & Account Takeover
Simultaneous token refresh requests from multi-tab sessions triggered false reuse detection, locking user accounts.
BGP Prefix Hijack Inadvertent Cryptocurrency Wallet Redirection
Rogue BGP route announcement redirected DNS queries for major cryptocurrency portal to malicious server for 2 hours.
LLM Tool Call Hallucination SQL Injection Parameter
LLM hallucinated unescaped string concatenation when generating dynamic SQL query from user input, allowing data extraction.
Cloud IAM Wildcard Permission Lateral Privilege Escalation
Overly permissive iam:PassRole on worker instances allowed compromised application to assume administrator role.
In the standards
CollectSEA's mapping; not an official determination by the standards bodies.