Running into 500 error constantly
agent-service-1 | 🚨 [root_playbook_orchestrator] Error during phase '2' execution: 500 INTERNAL. {'error': {'code': 500, 'message': 'An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting', 'status': 'INTERNAL'}} agent-service-1 | 🛑 [root_playbook_orchestrator] Stopping workflow due to error in phase '2'. agent-service-1 | 🏁 [root_playbook_orchestrator] Workflow execution finished. agent-service-1 | --- [root_playbook_orchestrator] Finished ---
I keep running into this in various parts of my code. Im using the Latest pro model that is still under preview.
I checked the link that it provides and it says 500 means too much context, but I checked and im defintely not overloading the context.
Im not able to figure out whats the issue here? Does anyone have any inklings? (I am using the vertex endpoints and classic ADK calling)
I dumped the terminal output to Gemini (AI studio) and asked it solve the error (classic) and this is what it came up with
The core issue remains the persistent 500 Internal Server Error from the Google Generative AI API (gemini-2.5-pro-preview-05-06).
The Trigger: The error occurs when your profile_agent makes its first call to the LLM. The prompt for this call is:
System: "You are a profile agent. Your job is to create a new profile, if the profile does not exist by looking for the name with [MY EMAIL REDACTED]. If the profile exists, set the state 'hb_profile_id' to the profile id. RETURN ONLY THE PROFILE ID AND NOTHING ELSE."
User: "hi"
Functions: create_profile, delete_profile, list_profiles.
Why this is happening:
Temporary Google API Issue: This is the most likely culprit for 500 errors. The service might be experiencing temporary overload, a deployment issue, or a bug on Google's side that affects certain types of requests or specific models like gemini-2.5-pro-preview-05-06.
Problem with the Specific Model Version: gemini-2.5-pro-preview-05-06 is a preview model. Preview models can sometimes be less stable or have stricter usage quotas/limitations than generally available (GA) models.
Rate Limiting (Less Likely for 500, but Possible): While rate limits usually result in 429 errors, extreme or misconfigured rate limiting on Google's side could manifest as a 500 if their internal systems can't cope.
Issue with Your Google Cloud Project/Billing: Unlikely to cause a 500 directly (usually permission errors are 401/403), but if there's a fundamental issue with your project's ability to use the API (e.g., billing not set up correctly, API not enabled, suspended project), it could potentially lead to unexpected server errors on Google's side.
Content of the Request (Less Likely for a simple "hi"): Sometimes, very specific content in a prompt (even if benign) might trigger an unhandled edge case in the model or API backend. However, with a simple "hi" as user input, this is less probable for this specific failing call. The previous run failed at a much later stage with a more complex prompt. The fact that it's now failing on a very simple, early call is more indicative of a broader API or model issue.
Regional Issues: The Google Cloud region you are targeting (or that your API key is associated with) might be experiencing problems.
I think it's likely just model server was busy?
Has it been back to normal? Or could you try a different model, e.g. 2.5-flash or 2.0-flash?
It's a very hit or miss and I intend move this to prod, since retry mechanism is not available in adk yet (or I'm tripping) , is there anything I can do for this?
Same here, kind of unpredictable, especially frequent in long-running agent tasks
@eliamazzon Are you using the vertex endpoint at all? I realized i was using the AI studio endpoint which from my understanding is turned on my default and I had use vertex to False
I havent tested it but this could be the root cause of the issue
I am running into this issue as well. What is the root cause for this? This is super unreliable as I plan to move my application into pilot with users. I keep getting 500 -- using 2.5 flash / flash-lite. Any help or guidance on this would be great!
Built-in retries for Gemini calls is now available in ADK v1.9.0. This could help make your ADK agents more robust so that it can retry automatically if the call to Gemini model fails.
- [Core] Expose Gemini RetryOptions to client (1639298)
It hasn't been added to the documentation yet (we're always open to PRs for docs!), but hopefully it's straightforward to understand how to use it for now:
root_agent = Agent(
model=Gemini(
model='gemini-2.0-flash',
retry_options=types.HttpRetryOptions(
initial_delay=1,
attempts=2
# ... Retry options from google.genai
),
# ...
),
For more details on the retry options, you can check the implementation in the underlying Python google-genai SDK, detailed in: https://github.com/googleapis/python-genai/pull/982/files
Hope this helps resolve the issue, but please re-open if the built-in retry mechanism doesn't quite solve your problem.