Edited at

bq CLI がエラーになったときの対処法


環境

Mac


現象

bq コマンドを使うと以下のエラーがでた。

例外エラー出たから問い合わせよてきな。

$ bq ls

You have encountered a bug in the BigQuery CLI. Please file a bug report in our public issue
tracker:
https://issuetracker.google.com/issues/new?component=187149&template=0
Please include a brief description of the steps that led to this issue, as well as any rows that can
be made public from the following information:

========================================
== Platform ==
CPython:2.7.10:Darwin-18.5.0-x86_64-i386-64bit
== bq version ==
2.0.31
== Command line ==
['/Users/*****/google-cloud-sdk/platform/bq/bq.py', '--application_default_credential_file', '/Users/*****/.config/gcloud/*****/*****/adc.json', '--credential_file', '/Users/*****/.config/gcloud/*****/*****/singlestore_bq.json', '--project=*****', 'ls']
== UTC timestamp ==
2019-05-10 03:57:51
== Error trace ==
Traceback (most recent call last):
File "/Users/*****/google-cloud-sdk/platform/bq/bq.py", line 995, in RunSafely
return_value = self.RunWithArgs(*args, **kwds)
File "/Users/*****/google-cloud-sdk/platform/bq/bq.py", line 2298, in RunWithArgs
filter_expression=self.filter)
File "/Users/*****/google-cloud-sdk/platform/bq/bigquery_client.py", line 1943, in ListDatasets
result = self.apiclient.datasets().list(**request).execute()
File "/Users/*****/google-cloud-sdk/platform/bq/bigquery_client.py", line 732, in apiclient
self._apiclient = self.BuildApiClient()
File "/Users/*****/google-cloud-sdk/platform/bq/bigquery_client.py", line 690, in BuildApiClient
_, discovery_document = http.request(discovery_url)
File "/Users/*****/google-cloud-sdk/platform/bq/third_party/oauth2client_4_0/transport.py", line 160, in new_request
credentials._refresh(orig_request_method)
File "/Users/*****/google-cloud-sdk/platform/bq/third_party/oauth2client_4_0/client.py", line 754, in _refresh
new_cred = self.store.locked_get()
File "/Users/*****/google-cloud-sdk/platform/bq/third_party/oauth2client_4_0/file.py", line 55, in locked_get
credentials = client.Credentials.new_from_json(content)
File "/Users/*****/google-cloud-sdk/platform/bq/third_party/oauth2client_4_0/client.py", line 310, in new_from_json
module_obj = __import__(module_name)
ImportError: No module named google_reauth.reauth_creds
========================================

Unexpected exception in ls operation: You have encountered a bug in the BigQuery CLI. Please file a
bug report in our public issue
tracker:
https://issuetracker.google.com/issues/new?component=187149&template=0
Please include a brief description of the steps that led to this issue, as well as any rows that can
be made public from the following information:


解決策

SDK をアンインストールし、再度インストールする。

アンインストールは下記で出力されたディレクトリを削除するだけ。

 gcloud info --format='value(installation.sdk_root)'

gcloud info --format='value(config.paths.global_config_dir)'

結局、原因は不明でした。


参考

https://cloud.google.com/sdk/docs/uninstall-cloud-sdk