Score:3

gcloud crashed (ValueError): Command type [CommandType.DESCRIBE] has already been registered

gq flag

I'm experiencing some strange errors with some of the gcloud CLI commands. These commands worked up until some point last week.

Most of the gcloud CLI commands work fine, A few that we need for our deployment scripts crash with strange errors, as follows

gcloud redis instances describe myinstance --region=us-central1
ERROR: gcloud crashed (InvalidSchemaError): Wait commands must include an async section.

and

gcloud compute networks vpc-access connectors list --region=us-central1
ERROR: gcloud crashed (ValueError): Command type [CommandType.DESCRIBE] has already been registered.

I have uninstalled and reinstalled the SDK, and it's still crashing. Also experienced on colleague's machines. (they're all MacOS on M1 silicon)

Versions where we have seen this:

  • 406.0.0 (before I re-installed)
  • 407.0.0 (after I re-installed)
  • 380.0.0 (colleague's machine)
  • 373.0.0 (another colleague's machine)

I have checked which gcloud to make sure it's the correct command.

The command works fine in Cloud Shell.

Is anyone else seeing this? What am I doing wrong?

Andy Watkins avatar
gq flag
Update: the vpc-access command seems to work on a colleague with a MacOS on Intel i5, (gcloud SDK v 367.0.0) but the redis command fails as above
Score:2
us flag

Are you running in a shell where python points to python version 3.11?

If you are using pyenv you can do:

pyenv install 3.10.6
pyenv global 3.10.6

to switch back to an older version. That worked for me

Andy Watkins avatar
gq flag
Thank you Nikolai -- It looks like we see the error message when the Python version found via $PATH is either too old _or_ too new. (whether you are using `venv` or `pyenv` or the default $PATH). Thank you for confirming what I thought was going on.
Score:0
gq flag

Commenting on my own post for anyone else who comes across this.

It appears that gcloud was trying to use python2. Removing all references to python2 in /usr/local/bin seems to have fixed the issue for me, but a colleague who has never installed Python2 still has the issue

We have a legacy project that still needs Py2

John Hanley avatar
cn flag
The CLI includes its own version of Python. Why was the CLI using your installation of Python? You did something either during the installation or afterwards that is affecting the usage (path) for Python. Note: I am **not** familiar with the CLI on macOS M1/M2. Add more details.
Andy Watkins avatar
gq flag
Thanks @JohnHanley - very useful. I delved into the CLI directory and although I found some python libraries, there does not seem to be a python executable; i.e. the CLI includes its own version of the Python _libraries_ The strange thing is that, having removed the symlink /usr/local/bin/python, the command is now working -- even when I add Python2 to the front of my path or set the CLOUDSDK_PYTHON environment variable.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.