Task Idempotency
Updated 2026-08-10
Summary
The property that running a task once and running it many times produce the same result, which makes retries safe after an uncertain failure.
Definition
Task Idempotency is the property that an operation produces the same state whether it is executed once or repeatedly, expressed formally as applying the operation twice yielding the same result as applying it once. Its core proposition is that when an operation is idempotent, a client that did not receive confirmation can retry without risking duplicated effects. The key qualifier is that idempotency requires enforcement, usually through a unique request key or a state machine, since a plain write operation is not idempotent by default.
Introduction
How to use
- Retry safety: make operations repeatable so that an uncertain failure can be retried freely. - Key design: attach a unique request identifier so that any duplicates can be reliably detected. - Effect check: verify that a repeated call does not double-charge, double-send, or double-create any record.
Mechanism
Networks fail in ways that leave the caller uncertain whether the operation happened, and retrying is the only recovery. Without idempotency, each retry risks applying the effect again, so duplicated charges and duplicate records appear exactly when the system is already degraded. A uniqueness key collapses repeated attempts into a single effect, which makes retrying safe by construction.
Practice
In progress 0/1Practice this model in one real situation:
Cases
- Payment systems deduplicate by order number so a retry after a timeout cannot charge twice.
- Messaging APIs use a message identifier so a repeated send does not deliver duplicate notifications.
Common pitfalls
- Assuming a read-only operation is automatically idempotent overlooks the writes it may trigger as a side effect.
- Relying on idempotency alone without locking still allows concurrent duplicates to slip through.
Sources
Source support: Explicit
References currently contain only Wikipedia links; primary sources still need review.
- en.wikipedia.orghttps://en.wikipedia.org/wiki/Idempotenceverified
account_treeGenealogyexpand_more
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS