Cognitive Scaffold

Preparing your thinking workspace

arrow_back_ios_new
MENTAL MODEL · M7429

Task Idempotency

Task Idempotency
StructuremediumLogic
Included
account_tree

Updated 2026-08-10

Loading revision record…

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.

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/1

Practice this model in one real situation:

Check to track your progress (stored locally)
Learning progress0%

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.

  • link
    en.wikipedia.orghttps://en.wikipedia.org/wiki/IdempotenceZH · Explicit
    verified
account_treeGenealogyexpand_more

RELATED MODELS