Cloud

Azure Blob Storage: diagnose an ETag conflict before forcing a write

A runbook for qualifying a 412 response, reconciling concurrent writes and resuming Blob Storage processing without overwriting a valid update.

27 Nov 2026 azureblob-storageconcurrencysecurityautomationobservabilityrunbookrollbackproduction

Two workers update the same manifest in Azure Blob Storage. After a deployment, one starts receiving 412 responses and processing falls behind. Removing the write condition may make the errors disappear, but can overwrite a valid update from the other worker. This fictional example uses a blob as a shared document, not as Terraform state.

The goal is to distinguish an expected collision from a malformed condition or another rejection, then resume without losing a business decision.

Contain and preserve evidence

Pause unbounded automatic retries and new processing for the affected manifest. Preserve queued messages, operation IDs, UTC times, application versions and the scope of affected blobs. Check downstream systems for effects already committed: a client timeout does not prove that a write failed.

For each attempt, record the Storage operation, HTTP status, service error code, available client and server request IDs, blob and observed version or ETag. Protect these logs and exclude SAS tokens, credentials and sensitive content. A 412 alone does not establish an ETag conflict: a date or tag condition, or a lease, can also reject a request.

Reconstruct the concurrent writes

For an update using If-Match, Blob Storage compares the supplied ETag with the current blob ETag. A mismatch fails the condition with a 412; if the condition holds, the write can succeed and the ETag changes. Treat an ETag as an opaque value and compare it exactly, without interpreting it.

text sequence.txt
T0  worker A reads manifest and ETag E1
T1  worker B reads manifest and ETag E1
T2  B writes with If-Match: E1: success, new ETag E2
T3  A writes with If-Match: E1: 412, condition not met
T4  A reads current content and ETag, then reassesses its intent

Compare each worker’s read and write traces, deployed versions, time between read and write, and replay triggers. A stale ETag can reflect a genuine concurrent update, an application cache or a condition attached to the wrong object. Check the service error code and other submitted conditions before settling on the cause. If the evidence cannot establish the sequence, record it as unknown.

Reconcile instead of repeating

Once an If-Match failure is confirmed, read the current content and ETag from the authoritative source. Compare the original intent with that state: was the operation already applied, is it still valid, can it be merged under business rules, or does it conflict? Retrying the old body with the new ETag can simply overwrite the concurrent change.

If the merge is defined and tested, rebuild the result from current state and submit another conditional write using its ETag. Bound the retry count and use a delay with jitter; on another conflict, read and calculate again. If merging is unsafe, send the operation for review or serialize writes per key using a mechanism that covers every producer.

Do not replace If-Match with * or remove the condition just to clear the alert: that removes the comparison with the version read. A lease is a different concurrency strategy, not an automatic repair. Identify its holder and consequences before intervening. See the blocking lease runbook.

Validate recovery and plan rollback

In an isolated environment with test data, make two workers read the same ETag and issue conditional writes. Verify that only one initially succeeds, the other receives the expected rejection, and both intents are reconciled according to the business rule. Also test an already-applied intent, a conflict that cannot be merged, another conflict during recovery and a timeout whose outcome must be checked before replay.

Before the canary, identify the owner, affected blobs and operations, a recoverable content reference if available, the stop threshold and the procedure for compensating external effects. Resume a limited scope and monitor 412s by error code, retries, backlog and business invariants, not just HTTP success. Expand after reconciling expected and actually applied operations.

If the canary fails, pause writes, return to the approved application version and inspect current state before restoring anything. Do not blindly overwrite valid changes with an old copy; restore or compensate with a concurrency condition and business-owner approval. If state or downstream effects remain uncertain, keep processing paused.

References