Protocol
Make the server check the version before writing
A second read does not close the gap between reading a record and overwriting it. The receiver must enforce the version condition when it handles the write.
Before you use it
- Use when
- Another person or process can edit the same record before your update reaches it.
Keep this limit in mind
- Reading twice is not atomic protection. The check must be enforced by the receiving system, with the correct version scope.
Current editorial reading
Use the reviewed version
For an HTTP API that supports this contract, read the representation and its strong entity tag, or ETag, together. Send that tag unchanged in If-Match with the intended update. Tags marked W/ are weak and cannot satisfy strong comparison. If-Match: * checks that a current representation exists; it does not pin your update to the version you reviewed.
Treat a conflict as new information
On a failed precondition, fetch the current record and reconcile changes before preparing another update. Do not strip the condition to force a stale write through. For example, a new emergency-contact number entered during your address correction must survive the correction. Test this race with safe data and check that the stale write is blocked. Follow documented handling if the receiver reports the change was already applied.
Take it with you
Before relying on a version condition, confirm that the receiving API enforces it on the representation you reviewed. Use its documented conflict handling rather than forcing a stale update.
Sources and evidence (1)
What we checked
If-Match requires strong entity-tag comparison; its wildcard tests existence, and a false condition forbids performing the requested method.
Selected normative passages inspected on 2026-10-04. The server may report success when it determines that the requested change was already applied. No API behavior was tested in this review.
RFC 9110: HTTP Semantics · Sections 8.8.3 and 13.1.1
For a state-changing request whose If-Match condition fails, RFC 9110 permits a success response when the requested change appears to have already been applied.
Rechecked on 2026-10-04. A failed comparison need not always surface as HTTP 412; recovery must interpret the receiving API’s documented outcome without forcing another write.
RFC 9110: HTTP Semantics · 13.1.1 If-Match, paragraphs following condition evaluation: already-applied 2xx response
Editorial sources (1)
Save and practise this idea
My learning
Read. Recall. Repeat.
Save this idea and return to it on any device.
Keep exploring
Connected ideas
You are readingMake the server check the version before writing
Ideas that link here
These ideas link to this one. Check their conditions and limits before use.
Compare with this ideaReuse the operation identity when retrying the same intentUseful with this idea
Approve the exact action that will actually run
Original edition evidence and sources
These records belong to the original released edition. The current editorial reading has its own evidence above; neither set silently replaces the other.
HTTP If-Match can make a state-changing request conditional on a matching representation version and prevent lost updates.
A client-side read followed by an unconditional write is not an atomic version check.
RFC 9110: HTTP Semantics · RFC 9110, section 13.1.1
All sources (1)
Original edition, downloads and provenance
The reading above is editorial version 1.0.0, bound to this exact source edition. The original data and saved downloads retain that edition and the separate editorial layer. They may contain earlier wording; use the current reading above when interpreting it.
Version 0.1.0
No review details are supplied for this edition.
Read the original edition and overlay as JSON · Release details