google-gemini / generative-ai-python

The official Python library for the Google Gemini API
https://pypi.org/project/google-generativeai/
Apache License 2.0
1.63k stars 324 forks source link

Can not find message descriptor by type_url: type.googleapis.com/plaque.trace.StatusContext #506

Closed barshag closed 2 months ago

barshag commented 3 months ago

Description of the bug:

I tried to upload file, and wait for the status to be "ACTIVE" but got "FAILED" and this message:

Can not find message descriptor by type_url: type.googleapis.com/plaque.trace.StatusContext

This is critical bug for me! please help me.

Actual vs expected behavior:

get ACTIVE instead of failed

Any other information you'd like to share?

No response

singhniraj08 commented 3 months ago

@barshag, Could you please provide a minimal reproducible code to help us analyze the issue(SDK version, steps followed before you ran into this error or stand alone code/colab gist) to reproduce the issue faced. Thanks!

barshag commented 3 months ago
# Function to wait for files to become active
def wait_for_files_active(*files):
    print("Waiting for file processing...")
    for name in (file.name for file in files):
        file = genai.get_file(name)
        while file.state.name == "PROCESSING":
            print(".", end="", flush=True)
            time.sleep(12)
            file = genai.get_file(name)
        print(file.state.name)
        if file.state.name == "FAILED":

            print(file)
            raise ValueError(file.state.name)
        if file.state.name != "ACTIVE":
            print("()()())(()()())")
            print(file)

            raise Exception(f"File {file.name} failed to process")
    print("...all files ready")

generativeai 0.7.2

It's pretty unstable... you should create much more valuable error messages... it's feel like blind debugging...

MarkDaoust commented 3 months ago

How often does this happen? Is this for some specific file, or at random here and there? If you retry with the same file does it pass the second time?

So far I've never gotten a state:FAILED. Any tips to help me reproduce this problem would be helpful.

github-actions[bot] commented 2 months ago

Marking this issue as stale since it has been open for 14 days with no activity. This issue will be closed if no further activity occurs.

github-actions[bot] commented 2 months ago

This issue was closed because it has been inactive for 28 days. Please post a new issue if you need further assistance. Thanks!