There are many reasons why you may receive a 40X error when attempting to access an asset's URL. Below you can find additional information about how to see specific error reasons, including possible and common reasons for such errors
When Cloudinary returns an error for an asset's delivery URL that failed to load due to a problem with the asset or URL, we return an HTTP header containing more information about why the request failed.
We also return this header for requests where an image was returned but there was a warning, such as when the default image placeholder was sent instead of the requested image.
This information is sent in the 'x-cld-error' HTTP header, and you can see the value by using your browser's web developer tools to examine the request and response for the image which didn't load correctly.
HTTP status codes
The HTTP status codes also indicate the reason a request was not successful, and for the most common error codes, there are likely reasons that the error occurred
400 - Bad Request
A 400 - Bad Request error is often returned when the delivery URL is invalid or not in the correct format/structure. For example, you will receive this error if you attempt to use a transformation key or value that doesn't exist or is not valid (e.g 'ab_cd' or width 0 - 'w_0').
Another reason can be if you attempt to use syntactically valid but conflicting transformations options. For instance, attempting to use the Automatic Gravity (g_auto) transformation with a crop mode that doesn't actually crop the image, such as "scale" which keeps all image data without requiring cropping .
Finally, another common reason is if your delivery URL is not in the right structure, such as if your cloud_name comes after the 'resource_type' (e.g. image) and 'type' (upload) or if the transformation options are added in the middle of the public_id. You can find out more details about the structure of Cloudinary URLs in the following section of our documentation:
401 - Unauthorized
This error is returned when there is some restriction in place which prevents the successful delivery of the requested asset. Common reasons include, if you are using Strict Transformations and attempting to generate a derived on-the-fly for a transformation that is not marked as "allowed" in your settings and if the URL is also not Signed.
You will also receive this error if you attempt to use an add-on or feature that is set as "restricted" in the Settings -> Security tab of your account settings. An example of this would be trying to use Client-side asset lists when the feature is restricted.
Additionally, this error can be returned if you are attempting to access a 'private' original asset, an 'authenticated' asset, or an asset to which access control options have been applied, but without supplying a valid signed URL or token.
404 - Not Found
A 404 Not Found error is returned if the requested resource is not found in your cloud and you are not using a default/placeholder image transformation. If you receive this unexpectedly for a recently-uploaded asset, note that you may be seeing a cache of an error that occurred before the file was uploaded.
Cloudinary caches 40X errors in an exponential backoff manner, first for 1 minute and each subsequent request for the same URL that leads to the error will double the expiry time up until a maximum of 24 hours.
This error cache is most often encountered for 404 Not Found errors when derived/transformed versions of original images are requested, but that original image hasn't yet been uploaded. If you are seeing a 40X error such as a 404, but upon checking the original image is indeed in your cloud, then a cached error is the likely explanation.
We have a support article which you can find below that provides more information about Cloudinary's error caching:
If none of the above scenarios explain the issue you are seeing, or if you have any additional questions, please create a ticket for our support team at https://support.cloudinary.com/hc/requests/new - and our team will check the details of the URL and the reason that it's not loading for you
Please sign in to leave a comment.