HTTP status and error codes for JSON

The following document provides reference information about the status codesand error messages that are used in the Cloud Storage JSON API. Forthe page specific to the Cloud Storage XML API, seeHTTP status and error codes for XML.

Error Response Format

Cloud Storage uses the standard HTTP error reporting format for theJSON API. Successful requests return HTTP status codes in the 2xx range. Failedrequests return status codes in the 4xx and 5xx ranges. Requests that require aredirect returns status codes in the 3xx range. Error responses usually includea JSON document in the response body, which contains information about theerror.

The following examples show some common errors. Note that the headerinformation in the responses is omitted.

401 Unauthorized

The following is an example of an error response you receive if you try tolist the buckets for a project but do not provide an authorization header.

401 Unauthorized{"error": { "errors": [  {   "domain": "global",   "reason": "required",   "message": "Login Required",   "locationType": "header",   "location": "Authorization"  } ], "code": 401, "message": "Login Required" }}

403 Forbidden

This is an example of an error response you receive if you try to list thebuckets of a non-existent project or one in which you don't have permissionto list buckets.

403 Forbidden{ "error": {  "errors": [   {    "domain": "global",    "reason": "forbidden",    "message": "Forbidden"    }  ],  "code": 403,  "message": "Forbidden" }}

404 Not Found

The following is an example of an error response you receive if you try toretrieve an object that does not exist.

404 Not Found{"error": { "errors": [  {   "domain": "global",   "reason": "notFound",   "message": "Not Found"  } ], "code": 404, "message": "Not Found" }}

409 Conflict

The following is an example of an error response you receive if you try tocreate a bucket using the name of a bucket you already own.

409 Conflict{"error": { "errors": [  {   "domain": "global",   "reason": "conflict",   "message": "You already own this bucket. Please select another name."  } ], "code": 409, "message": "You already own this bucket. Please select another name." }}

The following table describes the elements that can appear in the response bodyof an error. Fields should be used together to help determine the problem.Also, the example values given below are meant for illustration and are not anexhaustive list of all possible values.

ElementDescription
codeAnHTTP status code value, without the textual description.

Example values include:400 (Bad Request),401 (Unauthorized), and404 (Not Found).
errorA container for the error information.
errorsA container for the error details.
errors.domainThe scope of the error. Example values include:global andpush.
errors.locationThe specific item within thelocationType that caused the error. For example, if you specify an invalid value for a parameter, thelocation will be the name of the parameter.

Example values include:Authorization,project, andprojection.
errors.locationTypeThe location or part of the request that caused the error. Use withlocation to pinpoint the error. For example, if you specify an invalid value for a parameter, thelocationType will beparameter and thelocation will be the name of the parameter.

Example values includeheader andparameter.
errors.messageDescription of the error.

Example values includeInvalid argument,Login required, andRequired parameter: project.
errors.reasonExample values includeinvalid,invalidParameter, andrequired.
messageDescription of the error. Same as errors.message.

HTTP Status and Error Codes

This section provides a non-exhaustive list of HTTP status and error codes thatthe Cloud Storage JSON API uses. The1xx Informational and2xxSuccess codes are not discussed here. For more information, see Response StatusCodes inRFC 7231 §6,RFC 7232 §4,RFC 7233 §4,RFC 7235 §3, andRFC 6585.

302—Found

ReasonDescription
foundResource temporarily located elsewhere according to theLocation header.

303—See Other

ReasonDescription
mediaDownloadRedirectWhen requesting a download usingalt=media URL parameter, the direct URL path to use is prefixed by/download. If this is omitted, the service will issue this redirect with the appropriate media download path in theLocation header.

304—Not Modified

ReasonDescription
notModifiedThe conditional request would have been successful, but the condition was false, so no body was sent.

307—Temporary Redirect

ReasonDescription
temporaryRedirectResource temporarily located elsewhere according to theLocation header. Among other reasons, this can occur when cookie-based authentication is being used, e.g., when using theStorage Browser, and it receives a request to download content.

308—Resume Incomplete

Description
Indicates an incomplete resumable upload and provides the range of bytes already received by Cloud Storage. Responses with this status do not contain a body.

400—Bad Request

[Domain.]ReasonDescription
badRequestThe request cannot be completed based on your current Cloud Storage settings. For example, you cannot lock a retention policy if the requested bucket doesn't have a retention policy, and you cannot set ACLs if the requested bucket has uniform bucket-level access enabled.
badRequestExceptionThe retention period on a locked bucket cannot be reduced.
cloudKmsBadKeyBad Cloud KMS key.
cloudKmsCannotChangeKeyNameCloud KMS key name cannot be changed.
cloudKmsDecryptionKeyNotFoundResource's Cloud KMS decryption key not found.
cloudKmsDisabledKeyCloud KMS key is disabled, destroyed, or scheduled to be destroyed.
cloudKmsEncryptionKeyNotFoundCloud KMS encryption key not found.
cloudKmsKeyLocationNotAllowedCloud KMS key location not allowed.
corsRequestWithXOriginCORS request contains an XD3 X-Origin header.
customerEncryptionAlgorithmIsInvalidMissing an encryption algorithm, or the provided algorithm is not "AE256."
customerEncryptionKeyFormatIsInvalidMissing an encryption key, or it is not Base64 encoded, or it does not meet the required length of the encryption algorithm.
customerEncryptionKeyIsIncorrectThe provided encryption key is incorrect.
customerEncryptionKeySha256IsInvalidMissing a SHA256 hash of the encryption key, or it is not Base64 encoded, or it does not match the encryption key.
invalidThis error can occur for several reasons: The request is attempting to set aretention configuration for an object such that themode orretainUntilTime is not defined; or the request is attempting to set the properties of an object such that it would have a retention configuration and be subject to anevent-based hold at the same time; or the request is attempting to set an invalid retain-until date; or the request is attempting to set a retention configuration on an object stored in a bucket that doesn't have the feature enabled.
invalidAltValueThe value for thealt URL parameter was not recognized.
invalidArgumentThe value for one of fields in the request body was invalid.
invalidParameterThe value for one of the URL parameters was invalid. In addition to normal URL parameter validation, any URL parameters that have a corresponding value in provided JSON request bodies must match if they are both specified. If using JSONP, you will get this error if you provide analt parameter that is notjson.
notDownloadUploads or normal API request was sent to a/download/* path. Use the same path, but without the/download prefix.
notUploadDownloads or normal API request was sent to a/upload/* path. Use the same path, but without the/upload prefix.
parseErrorCouldn't parse the body of the request according to the provided Content-Type.
push.channelIdInvalidChannel ID must match the following regular expression:[A-Za-z0-9\\-_\\+/=]+
push.channelIdNotUniquestorage.objects.watchAll'sid property must be unique across channels.
push.webhookUrlNoHostOrAddressstorage.objects.watchAll'saddress property must contain a valid URL.
push.webhookUrlNotHttpsstorage.objects.watchAll'saddress property must be an HTTPS URL.
requiredA required URL parameter or required request body JSON property is missing.
resourceIsEncryptedWithCustomerEncryptionKeyThe resource is encrypted with a customer-supplied encryption key, but the request did not provide one.
resourceNotEncryptedWithCustomerEncryptionKeyThe resource is not encrypted with a customer-supplied encryption key, but the request provided one.
turnedDownA request was made to an API version that has been turned down. Clients will need to update to a supported version.
userProjectInvalidThe user project specified in the request is invalid, either because it is a malformed project id or because it refers to a non-existent project.
userProjectMissingThe requested bucket has Requester Pays enabled, the requester is not an owner of the bucket, and no user project was present in the request.
wrongUrlForUploadstorage.objects.insert must be invoked as an upload rather than a metadata.

401—Unauthorized

[Domain.]ReasonDescription
AuthenticationRequiredRequesterPaysAccess to a Requester Pays bucket requires authentication.
authErrorThis error indicates a problem with the authorization provided in the request to Cloud Storage. The following are some situations where that will occur:
  • The OAuth access token has expired and needs to be refreshed. This can be avoided by refreshing the access token early, but code can also catch this error, refresh the token and retry automatically.
  • Multiple non-matching authorizations were provided; choose one mode only.
  • The OAuth access token's bound project does not match the project associated with the provided developer key.
  • The Authorization header was of an unrecognized format or uses an unsupported credential type.
lockedDomainExpiredWhen downloading content from a cookie-authenticated site, e.g., using theStorage Browser, the response will redirect to a temporary domain. This error will occur if access to said domain occurs after the domain expires. Issue the original request again, and receive a new redirect.
requiredAccess to a non-public method that requires authorization was made, but none was provided in the Authorization header or through other means.

403—Forbidden

[Domain.]ReasonDescription
accountDisabledThe account associated with the project that owns the bucket or object has been disabled. Check theGoogle Cloud console to see if there is a problem with billing, and if not, contact account support.
countryBlockedThe Cloud Storage JSON API is restricted by law from operating with certain countries.
forbiddenThis error can occur for several reasons: According to access control policy, the current user does not have access to perform the requested action, and this can occur even if the resource being acted on doesn't exist; or the request is missing theoverrideUnlockedRetention query parameter but is attempting to change an object's existingretention configuration in a way that requires the parameter; or the request is attempting to change a locked object's retention configuration in a way that requires the object to be unlocked.
insufficientPermissionsAccording to access control policy, the current user does not have access to perform the requested action. This code applies even if the resource being acted on doesn't exist.
objectUnderActiveHoldObject replacement or deletion is not allowed due to anactive hold on the object.
retentionPolicyNotMetThe object is under retention and cannot be replaced or deleted until the date and time indicated. The retention might be due to aretention configuration on the object, aretention policy on the bucket, or both.
sslRequiredRequests to this API require SSL.
stopChannelCallerNotOwnerCalls tostorage.channels.stop require that the caller own the channel.
UserProjectAccessDeniedThe requester is not authorized to use the project specified in theuserProject portion of the request. The requester must have theserviceusage.services.use permission for the specified project.
UserProjectAccountProblemThere is a problem with the project used in the request that prevents the operation from completing successfully. One issue could be billing. Checkthe billing page to see if you have a past due balance or if the credit card (or other payment mechanism) on your account is expired. For project creation,see the Projects page in the Google Cloud console.

404—Not Found

ReasonDescription
notFoundEither there is no API method associated with the URL path of the request, or the request refers to one or more resources that were not found.

405—Method Not Allowed

ReasonDescription
methodNotAllowedThe HTTP verb is not supported by the URL endpoint used in the request. This can happen, for example, when using the wrong verb with the/upload or/download URLs.

408—Request Timeout

ReasonDescription
uploadBrokenConnectionThe request timed out. You shouldretry the request usingtruncated exponential backoff.

409—Conflict

ReasonDescription
conflictA request to change a resource, usually astorage.*.update orstorage.*.patch method, failed to commit the change due to a conflicting concurrent change to the same resource. The request can be retried, though care should be taken to consider the new state of the resource to avoid blind replacement of another agent's changes.

410—Gone

Description
You have attempted to use aresumable upload session orrewrite token that is no longer available. If the reported status code was not successful and you still wish to complete the upload or rewrite, you must start a new session.

411—Length Required

Description
You must provide the Content-Length HTTP header. This error has no response body.

412—Precondition Failed

ReasonDescription
conditionNotMetAt least one of the pre-conditions you specified did not hold.
orgPolicyConstraintFailedRequest violates an OrgPolicy constraint.
softDeletePolicyNotSetBucket does not have a soft delete policy.
objectNotSoftDeletedObject is not soft deleted and is either live or noncurrent.

413—Payload Too Large

ReasonDescription
uploadTooLargeThis error arises if you:
  • Attempt to upload an object larger than 5 TiB.
  • Attempt aCopy request that does not complete within 30 seconds and involves an object larger than 2.5 GiB. In this case, use theRewrite method instead.

416—Requested Range Not Satisfiable

ReasonDescription
requestedRangeNotSatisfiableThe requested Range cannot be satisfied.

429—Too Many Requests

[Domain.]ReasonDescription
usageLimits.rateLimitExceededACloud Storage JSON API usage limit was exceeded. If your application tries to use more than its limit, additional requests will fail. Throttle your client's requests, and/orretry requests usingtruncated exponential backoff.

499—Client Closed Request

Description
Theresumable upload was cancelled at the client's request prior to completion. This error has no response body.

500—Internal Server Error

ReasonDescription
backendErrorWe encountered an internal error. You shouldretry the request usingtruncated exponential backoff.
internalErrorWe encountered an internal error. You shouldretry the request usingtruncated exponential backoff.

502—Bad Gateway

This error is generated when there was difficulty reaching an internal service.It is not formatted with a JSON document. You shouldretry the requestusingtruncated exponential backoff.

503—Service Unavailable

ReasonDescription
backendErrorWe encountered an internal error. You shouldretry the request usingtruncated exponential backoff.

504—Gateway Timeout

This error is generated when there was difficulty reaching an internal service.It is not formatted with a JSON document. You shouldretry the requestusingtruncated exponential backoff.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-17 UTC.