Unhandled exception. Azure.RequestFailedException: The value for one of the HTTP headers is not in the correct format – Azurite with Docker + dotnet core

Joe Blogs

My project is based on a Microservice architecture, using dotnet core, Angular, and other services in Azure such as Azure Blob Storage, for which I use Azurite locally for simulation purposes. The Microservices are all run using docker-compose.

Recently I updated the Azure.Storage.Blobs nuget package from 12.9.1 to 12.10.0, this is when the following error started to appear:

Unhandled exception. Azure.RequestFailedException: The value for one of the HTTP headers is not in the correct format.
RequestId:a77caa05-9803-47fe-bf05-b3e3693e453a
Time:2021-09-17T13:36:38.448Z
Status: 400 (The value for one of the HTTP headers is not in the correct format.)
ErrorCode: InvalidHeaderValue
workrequest.backgroundtasks_1  |
Additional Information:
HeaderName: x-ms-version
HeaderValue: 2020-10-02
workrequest.backgroundtasks_1  |
Content:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Error>
  <Code>InvalidHeaderValue</Code>
  <Message>The value for one of the HTTP headers is not in the correct format.
RequestId:a77caa05-9803-47fe-bf05-b3e3693e453a
Time:2021-09-17T13:36:38.448Z</Message>
  <HeaderName>x-ms-version</HeaderName>
  <HeaderValue>2020-10-02</HeaderValue>
</Error>
workrequest.backgroundtasks_1  |
Headers:
Server: Azurite-Blob/3.12.0
x-ms-error-code: InvalidHeaderValue
x-ms-request-id: a77caa05-9803-47fe-bf05-b3e3693e453a
Date: Fri, 17 Sep 2021 13:36:38 GMT
Connection: keep-alive
Keep-Alive: REDACTED
Transfer-Encoding: chunked
Content-Type: application/xml

To solve this issue, I deleted the Azurite docker image, pulled the latest image, and everything started working again.

To do this use the following commands:

  • docker image ls – This will list all of the images, find the image and use the id to delete the image
  • docker rmi {id_of_image_here}

I hope this helps someone!