GoogleCloudPlatform / GoogleCloudPlatform/generative-ai

[Bug]:

Open
#3,061 1 comment 0 reactions 1 assignee Claimed by @polong-lin View on GitHub
Dominant language
Jupyter Notebook
Stars
17.7k
Forks
4.5k
Avg merge
12h 38m
Merged PRs (30d)
42

Description

### File Name

https://github.com/GoogleCloudPlatform/generative-ai/blob/main/gemini/multimodal-live-api/live_api_quickstart.ipynb

### What happened?

I am connecting throough ec2 instance. I am able to connect all the gemini model like gemini-3.6-flash, gemini-3.5-flash-liteetcg. but when tring to conenct gemini-live-2.5-flash-native-audio, I am getting the follwoing Error:
```
--------------------------------------------------------------------------
ConnectionClosedError Traceback (most recent call last)
File ~/llmagent/lib/python3.12/site-packages/google/genai/live.py:1108, in AsyncLive.connect(self, model, config)
1106 try:
1107 # websockets 14.0+
-> 1108 raw_response = await ws.recv(decode=False)
1109 except TypeError:

File ~/llmagent/lib/python3.12/site-packages/websockets/asyncio/connection.py:324, in Connection.recv(self, decode)
323 await asyncio.shield(self.connection_lost_waiter)
--> 324 raise self.protocol.close_exc from self.recv_exc

ConnectionClosedError: received 1008 (policy violation) Permission denied on resource project None.; then sent 1008 (policy violation) Permission denied on resource project None.

During handling of the above exception, another exception occurred:

APIError Traceback (most recent call last)
Cell In[23], line 7
3 config = {
4 "response_modalities": ["audio"],
5 }
6
----> 7 async with client.aio.live.connect(
8 model=MODEL_ID,
9 config=config,
10 ) as session:

File /usr/lib/python3.12/contextlib.py:210, in _AsyncGeneratorContextManager.__aenter__(self)
208 del self.args, self.kwds, self.func
209 try:
--> 210 return await anext(self.gen)
211 except StopAsyncIteration:
212 raise RuntimeError("generator didn't yield") from None

File ~/llmagent/lib/python3.12/site-packages/google/genai/live.py:1118, in AsyncLive.connect(self, model, config)
1116 code = 1006
1117 reason = 'Abnormal closure.'
-> 1118 errors.APIError.raise_error(code, reason, None)
1119 if raw_response:
1120 try:

File ~/llmagent/lib/python3.12/site-packages/google/genai/errors.py:206, in APIError.raise_error(cls, status_code, response_json, response)
204 raise ServerError(status_code, response_json, response)
205 else:
--> 206 raise cls(status_code, response_json, response)

APIError: 1008 None. Permission denied on resource project None.
```

### Relevant log output

```shell

```

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.