Transport Error

I need help. I can’t download the notebook from the course Jupyter notebook, so I have to use Google Colab, I execute this code: for m in palm.list_models():
print(f"name: {m.name}“)
print(f"description: {m.description}”)
print(f"generation methods:{m.supported_generation_methods}\n") in Google Colab and got this error: ---------------------------------------------------------------------------

TransportError Traceback (most recent call last)

/usr/local/lib/python3.10/dist-packages/google/auth/compute_engine/credentials.py in refresh(self, request) 110 try: → 111 self._retrieve_info(request) 112 self.token, self.expiry = _metadata.get_service_account_token(


13 frames

TransportError: (“Failed to retrieve http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/?recursive=true from the Google Compute Engine metadata service. Status: 404 Response:\nb’'”, <google.auth.transport.requests._Response object at 0x7ddce4d1db40>)

The above exception was the direct cause of the following exception:

RefreshError Traceback (most recent call last)

/usr/local/lib/python3.10/dist-packages/six.py in raise_from(value, from_value)

RefreshError: (“Failed to retrieve http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/?recursive=true from the Google Compute Engine metadata service. Status: 404 Response:\nb’'”, <google.auth.transport.requests._Response object at 0x7ddce4d1db40>)

1 Like

Hi @Cheong_Wai_Ling,

Try downloading your workspace this way.

  1. Open the notebook.
  2. After the notebook opens up, click File → Open...
  3. After the workspace opens up, click the checkbox next to the notebook, it will then show you a Shutdown option, click that. This will turn your notebook icon from green to grey.
  4. Next, click the checkbox next to the notebook again, and now you’ll see the Download option.
1 Like

Hi Mubsi,
Thank you for your response. I have already download the notebook and then upload to Google Colab to execute the code. The problem is that one of the code snippet causing an error after executed as my previous mentioned. This code snippet got error:
for m in palm.list_models():
print(f"name: {m.name}“)
print(f"description: {m.description}”)
print(f"generation methods:{m.supported_generation_methods}\n")

1 Like

Hi @Cheong_Wai_Ling,

Please make sure you are using the same library version on colab as they are in the platform.

1 Like

Hi Mubsi,
I had using the same library. This is the error and I also don’t know what is that mean:
TransportError Traceback (most recent call last)

/usr/local/lib/python3.10/dist-packages/google/auth/compute_engine/credentials.py in refresh(self, request) 110 try: → 111 self._retrieve_info(request) 112 self.token, self.expiry = _metadata.get_service_account_token(


13 frames

TransportError: (“Failed to retrieve http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/?recursive=true from the Google Compute Engine metadata service. Status: 404 Response:\nb’'”, <google.auth.transport.requests._Response object at 0x7ddce4d1db40>)

The above exception was the direct cause of the following exception:

RefreshError Traceback (most recent call last)

/usr/local/lib/python3.10/dist-packages/six.py in raise_from(value, from_value)

RefreshError: (“Failed to retrieve http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/?recursive=true from the Google Compute Engine metadata service. Status: 404 Response:\nb’'”, <google.auth.transport.requests._Response object at 0x7ddce4d1db40>)

1 Like

Hi @Cheong_Wai_Ling,

Could you mention the name of the lecture ?

Hi Mubsi,
Thank you for your response. Is L3. But I manage solved it.

Oh that’s great. How were you able to solve it ?

I to added my .env into the utils.py.

import os
from dotenv import load_dotenv, find_dotenv

def get_api_key():

_ = load_dotenv('.env') # read local .env file
return os.getenv('GOOGLE_API_KEY')