Microsoft.WindowsAzure.Storage.StorageException: Unexpected response code for operation ….

At times you would get errors such as below while executing batch transactions on a table in table storage

 Microsoft.WindowsAzure.Storage.StorageException: Unexpected response code for operation : 5
    at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](StorageCommandBase`1 cmd, IRetryPolicy policy, OperationContext operationContext)
    at Microsoft.WindowsAzure.Storage.Table.CloudTable.ExecuteBatch(TableBatchOperation batch, TableRequestOptions requestOptions, OperationContext operationContext)
    at Worker.Processors.QueueOneProcessor.FlushCache()
 Request Information
 RequestDate:Tue, 21 May 2013 13:48:55 GMT

One of the most common reason of such failure is malformed parameters passed in the query such as using disallowed characters in partitionkey or rowkey. The reason for the error above is that partitionkey contained a disallowed character “?”.  Refer to  which specifies below


 Characters Disallowed in Key Fields
The following characters are not allowed in values for the PartitionKey and RowKey properties:

 • The forward slash (/) character
 • The backslash (\) character
 • The number sign (#) character
 • The question mark (?) character

If you are getting the aforementioned error then please check if the partitionkey or rowkey being passed contains a disallowed character and rectify it.

Comments (4)

  1. Simon Cropp says:

    wish the exception was better. eg "the character '/' is not allowed in a rowkey"

  2. Matthew Kosko says:

    I think the reason I saw a similar error was that I was trying to update the same row twice in 1 batch. Fixing the code so each row is only updated once per batch resolved the error.

  3. OLT says:


    "In my scenario I had a null value pushed into a DateTime property"

  4. Mike says:

    Thank you! This is much more helpful than "Unexpected response code" error it gives back.