Recently Windows Azure Table Storage access code which was working fine started giving the following error:

412 Precondition Failed

The server does not meet one of the preconditions that the requester put on the request

Stack Trace:

System.Data.Services.Client.DataServiceRequestException was unhandled
Message=An error occurred while processing this request.
Source=Microsoft.WindowsAzure.StorageClient
StackTrace:
at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result()
at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.ExecuteAndWait()
at Microsoft.WindowsAzure.StorageClient.TaskImplHelper.ExecuteImplWithRetry[T](Func`2 impl, RetryPolicy policy)
at Microsoft.WindowsAzure.StorageClient.TableServiceContext.SaveChangesWithRetries(SaveChangesOptions options)
at Microsoft.WindowsAzure.StorageClient.TableServiceContext.SaveChangesWithRetries()
…….
……..
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart(Object obj)
InnerException: System.Data.Services.Client.DataServiceClientException
Message=<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code>ConditionNotMet</code>
<message xml:lang="en-US">The condition specified using HTTP conditional header(s) is not met.
RequestId:43b34531-c1ed-34ab-654a-53b3f3238764
Time:2011-08-12T12:27:13.6404017Z</message>
</error>
Source=System.Data.Services.Client
StatusCode=412
StackTrace:
at System.Data.Services.Client.DataServiceContext.SaveResult.<HandleBatchResponse>d__1e.MoveNext()
InnerException:

 

The potential problem could be that you have a context which is tracking table update process. Later due to eTag mismatch this updated is failed and now that context is reused (even for other changes), it will continue sending the failed update.