generative-ai-python icon indicating copy to clipboard operation
generative-ai-python copied to clipboard

Frequent 500 errors: error counting image token, media index[0] err: failed to decode base64 string: illegal base64 data at input byte 0 (request id: 2025101012300457216932209497692)', 'type': 'shell_api_error', 'param': '', 'code': 'count_token_failed'}

Open dzqjk opened this issue 2 months ago • 1 comments

Description of the bug:

This problem frequently occurs when using Python 3.10 to call google-genai version 1.38.0. The image file encoding uses the following method with open(image_path, 'rb') as image_file: return base64.b64encode(image_file.read()).decode('utf-8')

error_info.txt

The above files are specific return information

Actual vs expected behavior:

No response

Any other information you'd like to share?

No response

dzqjk avatar Oct 10 '25 04:10 dzqjk

Description of the bug:

This problem frequently occurs when using Python 3.10 to call Google's version 1.38.0. The image file encoding uses the following method with open(image_path, 'rub') as image_file: return base64.encoded(image_file.read()).decode('outfit') codespaces-diagram.png error_info.txt

The above files are specific return information

Actual vs expected behavior:

No response

Any other information you'd like to share?

No response

m74278803-cmyk avatar Oct 28 '25 13:10 m74278803-cmyk