0

I'm encountering a UTF-8 decode error while installing Google Cloud SDK via Homebrew on macOS. Initially, I tried to download files from Google Cloud Storage using `gsutil -m cp* and received this error. Because of this, I attempted to reinstall the gcloud CLI.

Environment:

  • OS: macOS
  • Command: brew install --cask google-cloud-sdk
  • Python version: 3.12.9

Error:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd7 in position 13385: invalid continuation byte

What I've tried:

Removed all gcloud configurations Cleared local cache

Traceback

==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-cask/a6b965b2b096b2cd338a3b9bdbf016dfa245290e/Casks/g/google-cloud-sdk.rb
Already downloaded: /Users/a02230/Library/Caches/Homebrew/downloads/b4cc1ad0c7e45025329c807394999d11c9a3deac2b3bdc1a18f9ae6c6c206ecb--google-cloud-sdk.rb
==> Downloading https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-523.0.0-darwin-arm.tar.gz
Already downloaded: /Users/a02230/Library/Caches/Homebrew/downloads/6d32e4d2865a4959098824bbeef0bc5eb60a2b7782841b872a817028acc7ea0c--google-cloud-cli-523.0.0-darwin-arm.tar.gz
All dependencies satisfied.
==> Installing Cask google-cloud-sdk
==> Running installer script 'google-cloud-sdk/install.sh'
Welcome to the Google Cloud CLI!
Traceback (most recent call last):
 File "/opt/homebrew/share/google-cloud-sdk/bin/bootstrapping/install.py", line 395, in <module>
 main()
 ~~~~^^
 File "/opt/homebrew/share/google-cloud-sdk/bin/bootstrapping/install.py", line 368, in main
 Install(
 ~~~~~~~^
 pargs.override_components,
 ^^^^^^^^^^^^^^^^^^^^^^^^^^
 pargs.additional_components,
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 pargs.no_compile_python,
 ^^^^^^^^^^^^^^^^^^^^^^^^
 )
 ^
 File "/opt/homebrew/share/google-cloud-sdk/bin/bootstrapping/install.py", line 228, in Install
 _CLI.Execute(['--quiet', 'components', 'list'])
 ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 1011, in Execute
 self._HandleAllErrors(exc, command_path_string, specified_arg_names)
 ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 1048, in _HandleAllErrors
 exceptions.HandleError(exc, command_path_string, self.__known_error_handler)
 ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/calliope/exceptions.py", line 586, in HandleError
 core_exceptions.reraise(exc)
 ~~~~~~~~~~~~~~~~~~~~~~~^^^^^
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/exceptions.py", line 149, in reraise
 six.reraise(type(exc_value), exc_value, tb)
 ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/opt/homebrew/share/google-cloud-sdk/lib/third_party/six/__init__.py", line 719, in reraise
 raise value
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 985, in Execute
 resources = calliope_command.Run(cli=self, args=args)
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 945, in Run
 resources = command_instance.Run(args)
 File "/opt/homebrew/share/google-cloud-sdk/lib/surface/components/list.py", line 101, in Run
 update_manager = util.GetUpdateManager(args)
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/command_lib/components/util.py", line 71, in GetUpdateManager
 return update_manager.UpdateManager(
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
 sdk_root=root, url=url, platform_filter=platform,
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 skip_compile_python=(not compile_python))
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/updater/update_manager.py", line 362, in __init__
 universe_domain = properties.GetUniverseDomain()
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/properties.py", line 4677, in GetUniverseDomain
 return VALUES.core.universe_domain.Get()
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/properties.py", line 4162, in Get
 property_value = self.GetPropertyValue(required, validate)
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/properties.py", line 4181, in GetPropertyValue
 property_value = _GetProperty(self,
 named_configs.ActivePropertiesFile.Load(),
 required)
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/properties.py", line 4503, in _GetProperty
 property_value = _GetPropertyWithoutDefault(prop, properties_file)
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/properties.py", line 4561, in _GetPropertyWithoutDefault
 value = callback()
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/credentials/store.py", line 248, in GetUniverseDomain
 return c_gce.Metadata().UniverseDomain()
 ~~~~~~~~~~~~~~^^
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/credentials/gce.py", line 341, in Metadata
 _metadata = _GCEMetadata()
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/credentials/gce.py", line 113, in __init__
 self.connected = gce_cache.GetOnGCE()
 ~~~~~~~~~~~~~~~~~~^^
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/credentials/gce_cache.py", line 190, in GetOnGCE
 return _SINGLETON_ON_GCE_CACHE.GetOnGCE(check_age)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/credentials/gce_cache.py", line 118, in GetOnGCE
 return self.CheckServerRefreshAllCaches()
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/credentials/gce_cache.py", line 121, in CheckServerRefreshAllCaches
 on_gce = self._CheckServerWithRetry()
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/credentials/gce_cache.py", line 171, in _CheckServerWithRetry
 return self._CheckServer()
 ~~~~~~~~~~~~~~~~~^^
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/util/retry.py", line 307, in DecoratedFunction
 return retryer.RetryOnException(f, args=args, kwargs=kwargs,
 ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 should_retry_if=should_retry_if,
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 sleep_ms=sleep_ms)
 ^^^^^^^^^^^^^^^^^^
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/util/retry.py", line 201, in RetryOnException
 exceptions.reraise(exc_info[1], tb=exc_info[2])
 ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/exceptions.py", line 149, in reraise
 six.reraise(type(exc_value), exc_value, tb)
 ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/opt/homebrew/share/google-cloud-sdk/lib/third_party/six/__init__.py", line 719, in reraise
 raise value
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/util/retry.py", line 182, in TryFunc
 return func(*args, **kwargs), None
 ~~~~^^^^^^^^^^^^^^^^^
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/credentials/gce_cache.py", line 178, in _CheckServer
 return gce_read.ReadNoProxy(
 ~~~~~~~~~~~~~~~~~~~~^
 gce_read.GOOGLE_GCE_METADATA_NUMERIC_PROJECT_URI,
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 properties.VALUES.compute.gce_metadata_check_timeout_sec.GetInt(),
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ).isdigit()
 ^
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/credentials/gce_read.py", line 65, in ReadNoProxy
 return http_encoding.Decode(result)
 ~~~~~~~~~~~~~~~~~~~~^^^^^^^^
 File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/util/http_encoding.py", line 34, in Decode
 return s.decode('utf-8')
 ~~~~~~~~^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd7 in position 13385: invalid continuation byte
==> Purging files for version 523.0.0 of Cask google-cloud-sdk
Error: Failure while executing; `/usr/bin/env PATH=/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/Library/Homebrew/shims/shared:/usr/bin:/bin:/usr/sbin:/sbin /opt/homebrew/Caskroom/google-cloud-sdk/523.0.0/google-cloud-sdk/install.sh --quiet --usage-reporting false --bash-completion false --path-update false --rc-path false --install-python false` exited with 1. Here's the output:
Welcome to the Google Cloud CLI!

Expected behavior:

Google Cloud SDK should be installed successfully.

asked May 22, 2025 at 10:30
1
  • I'm curios as to why you're using brew to install gcloud CLI. Did you try simply downloading and extracting the files? That's essentially what the instructions says - see documentation Commented May 26, 2025 at 19:14

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.