Is there an exhaustive list of what can cause an "OutOfRangeInput" error code in a 400 Bad Request response from Azure blob storage?
Hi,
I'm working on an application that allow our users to communicate with Azure Blob storage.
We perform REST API behind the scenes while they just call our API to interact with their data.
To help the users, we want to provide useful error messages in case something goes wrong with any request.
One I'm having trouble with is when the container name is invalid.
For example, if I specify an invalid container name, e.g. less than three characters (https://learn.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata),
I get a 400 Bad Request as a response.
The code and message (code and message as defined here: https://learn.microsoft.com/en-us/rest/api/storageservices/status-and-error-codes2) in the response body are:
<Code>OutOfRangeInput</Code>
<Message>The specified resource name length is not within the permissible limits.
RequestId:...
Time:...</Message>
(RequestId and Time values removed above).
Internally, we parse the response and translate the errors to one of our own error types (in this case that it's an invalid container).
To do this, I need to be able to identify that the response corresponds to an invalid container name.
However, with the response data I receive from Azure, I'm not sure I can properly do so:
1) If I were to use the message, "The specified resource name length is not within the permissible limits.", to identify that the response corresponds to an invalid container name, there are a couple of issues:
i. It looks like this message string isn't documented. From the Azure docs:
https://learn.microsoft.com/en-us/rest/api/storageservices/common-rest-api-error-codes
the documented message for "OutOfRangeInput" is "One of the request inputs is out of range.".
In fact, I can't find "The specified resource name length is not within the permissible limits." mentioned anywhere in the doc, just on forums where users received it as an error.
We cannot rely on undocumented features, so that rules the message out.
ii. Even if it was documented though, there's no mention of whether the string is guaranteed to not change.
If a capitalization is changed or similar, it means we won't match with it.
iii. Another potential issue with using the message is localization.
It looks like some messages are localized, see e.g.:
https://learn.microsoft.com/ja-jp/rest/api/storageservices/common-rest-api-error-codes
perhaps this could change from under our feet, if a message is updated to be localized.
2) If instead I were to use the code "OutOfRangeInput" to identify the error, looking at the doc again:
https://learn.microsoft.com/en-us/rest/api/storageservices/common-rest-api-error-codes
its message is "One of the request inputs is out of range.".
I am not sure I can therefore interpret this error code to solely describe an incorrectly named container, or if the code is used for other errors as well (e.g. when writing data to the storage).
All in all, while I've ruled out using the message, I'm not sure about the code.
I struggle to find any documentation of what can cause an "OutOfRangeInput".
So, I'm wondering if there's an exhaustive list of what can cause an "OutOfRangeInput" error code, or if there's any other way to find out all issues that can cause it?
Best regards,
Jim