Skip to content

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'} #751

@dzqjk

Description

@dzqjk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions