googleapis / googleapis/python-genai

client.files.list() raises ServerError 500: "Failed to convert server response to JSON"

Aperta
#815 19 commenti 8 reazioni 1 assegnatario Assegnata a @kkorpal Vedi su GitHub
api: gemini-api priority: p2 type: bug
Lingua principale
Python
Stelle
4k
Fork
1k
Merge medio
2g 12h
PR unite (30g)
41

Descrizione

Hi team,

I'm using the Google Generative AI Python SDK and encountering an unexpected internal error when calling client.files.list(). This function was working until yesterday, but it has now started consistently throwing a server-side error. Below is the traceback:
Traceback (most recent call last):
File "/home/hetpandya/Research/Loom AI/list.py", line 10, in
for f in client.files.list():
^^^^^^^^^^^^^^^^^^^
File "/home/hetpandya/.local/lib/python3.12/site-packages/google/genai/files.py", line 714, in list
self._list(config=config),
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/hetpandya/.local/lib/python3.12/site-packages/google/genai/files.py", line 385, in _list
response_dict = self._api_client.request(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/hetpandya/.local/lib/python3.12/site-packages/google/genai/_api_client.py", line 674, in request
response = self._request(http_request, stream=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/hetpandya/.local/lib/python3.12/site-packages/google/genai/_api_client.py", line 603, in _request
errors.APIError.raise_for_response(response)
File "/home/hetpandya/.local/lib/python3.12/site-packages/google/genai/errors.py", line 103, in raise_for_response
raise ServerError(status_code, response_json, response)
google.genai.errors.ServerError: 500 INTERNAL. {'error': {'code': 500, 'message': 'Failed to convert server response to JSON', 'status': 'INTERNAL'}}

Environment:

SDK version: [google-genai==1.11.0]

Python version: 3.9

OS: Ubuntu 22.04

Steps to reproduce:

Set up client from the SDK.

Call client.files.list()

Observe the crash.

Expected behavior:

The method should return a list of files or an appropriate client-side error, not a server-side 500 with an invalid JSON response.
Actual behavior:

The SDK raises google.genai.errors.ServerError with a message indicating the response couldn't be converted to JSON.

Please let me know if there's an alternative method I should use, or if this is a known issue being addressed.

Thanks!

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.