Python 2.7 has reached end of supportand will bedeprecatedon January 31, 2026. After deprecation, you won't be able to deploy Python 2.7applications, even if your organization previously used an organization policy tore-enable deployments of legacy runtimes. Your existing Python2.7 applications will continue to run and receive traffic after theirdeprecation date. We recommend thatyoumigrate to the latest supported version of Python.

Cloud Storage Errors and Error Handling

Google Cloud Storage is accessed by the App Engine UrlFetch feature. As a result,there are three sources of possible errors:

  • App Engine UrlFetch transient errors.
  • Google Cloud Storage transient errors.
  • Google Cloud Storage errors related to buckets and object authorization.

The App Engine client library for Cloud Storage handles timeout errors on both the App Engine side andthe Google Cloud Storage side and performs retries automatically, so your app does not need toadd logic to handle this. The configuration of the timeout and retry mechanismis exposed through theRetryParamsclass, which you can use to change any or all of the default settings. You canmake your changes to apply to all function calls or you can specify changes fora specific call using the function'sretry_params parameter.

Errors

The App Engine client library for Cloud Storage has the following error exception classes defined:

cloudstorage.Error

The base class for all exceptions in this package. Errors can begenerated from App Engine or from Google Cloud Storage. For details on HTTPerror codes from Google Cloud Storage, seeHTTP Status and ErrorCodes in the Google Cloud Storage documentation.

cloudstorage.AuthorizationError
An unauthorized request was received by Google Cloud Storage. This error can occur if anauthorized app is using an access token that has expired. Normally, this erroris handled automatically in the App Engine client library for Cloud Storage, which gets a new access tokenand retries the request.
cloudstorage.ForbiddenError

This error (403) indicates that the user was not authorized by Google Cloud Storage tomake the request.

cloudstorage.NotFoundError
HTTP error 404. The bucket or object you specified in a call tocloudstorage.delete(),cloudstorage.listbucket(),cloudstorage.open(), orcloudstorage.stat() does not exist.
cloudstorage.TimeoutError
This error is raised when the attempt to contact Google Cloud Storage servers times out evenafter retry attempts. (SeeRetryParamsfor information on changing the default timeout handling and retries.

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-15 UTC.