WARNING: All log messages before absl::InitializeLog() is called are written to STDERR E0000 00:00:1731955515.629532 17124 init.cc:229] grpc_wait_for_shutdown_with_timeout() timed out

I’m getting this error suddenly when using the gemini-1.5-flash model.

It says
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1731955515.629532 17124 init.cc:229] grpc_wait_for_shutdown_with_timeout() timed out.
there is no response being printed -

4 Likes

Same Here. I am also facing the same problem.

1 Like

Welcome to the forums!

This seems pretty strange. Can you clarify what library you’re using and possibly show a sample code that is causing this error?

I am also getting same warning, here is my code,

import google.generativeai as genai
genai.configure(api_key='')

model = genai.GenerativeModel("gemini-1.5-flash")
response = model.generate_content("Explain how AI works")
print(response.text)

Hey @Sumit_Jadhav,

It looks intermittent error, working fine for me. Check if you are still facing the same issue.

I am also facing the same issue when i am doing the Image analysis.
Infact i added an explicit timeout. But it looks like its not honoring that.

By the way I am using Experimental 1121 model.

response = model.generate_content(
[uploaded_file, “\n\n”, prompt],request_options={“timeout”: 240}
)

Same issue.
With flash and exp-1121.
Interestingly, when I send the output (via print) to stdout I can read it and then I see the error but when I’m using Gemini’s response in a script it seems to not save the response due to the error.

(Didn’t do a full debug, but that’s what it seems like so far)

+1 same issue here
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1732664313.522866 17588 init.cc:229] grpc_wait_for_shutdown_with_timeout() timed out.

Sure! Here are a few options:

  • Thanks for the heads up - I’ll check my code for similar issues.
  • I’m also seeing this error. Any ideas on how to fix it?
  • This seems to be a common problem. Hopefully, we can get a solution soon.
1 Like

Is there any resolution to this so far?

Just by trying with very simple prompt in gemini-1.5-flash I’m getting the same error.

pip install grpcio==1.67.1
This helped me from the situation.

7 Likes

That worked for me too!
Any reason why this particular grpc version worked?

Hello,

It seems like several users, including myself, have encountered the “grpc_wait_for_shutdown_with_timeout() timed out” error. I appreciate the suggestion to try installing grpcio==1.67.1. I’m going to give that a shot and see if it resolves the issue for me as well.

Thank you,
Mohd Ramlan

Thank you very much!

Prev. env: Python 3.12.4, grpcio==1.68.1.
Downgraded to grpcio==1.67.1 which resolved the warning.

1 Like

Thank you very much! it works!

thanks… worked here too.