adk-python icon indicating copy to clipboard operation
adk-python copied to clipboard

An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting'

Open momo-tuannguyen12 opened this issue 1 year ago • 7 comments

INFO:google_genai.models:AFC is enabled with max remote calls: 10. INFO:httpx:HTTP Request: POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:generateContent "HTTP/1.1 500 Internal Server Error" 2025-06-27 13:45:53 - ERROR - backend.app.agents.reasoning_agent - Reasoning error: 500 INTERNAL. {'error': {'code': 500, 'message': 'An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting', 'status': 'INTERNAL'}}

From today, our system get error when running with model gemini-2.5-pro. (Yesterday it still work fine). For normally chatting (without tools), Agent use model gemini-2.5-pro and can reply me. But when I ask model to task (within tools), the error occurs.

I change to gemini-2.5-flash, It works but cannot process my request better than as gemini-2.5-pro.

I know that is issue of Google's side. But how if we build a production with 1M users and we run into this error today?

I Switched to ChatGPT Model and got error litellm.BadRequestError: AzureException BadRequestError - An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. The following tool_call_ids did not have response messages: call_OfGWMO54mMKIv2FErSD1aS56

Look ADK is not stable for Chat GPT model.

Please give me advise!

momo-tuannguyen12 avatar Jun 27 '25 07:06 momo-tuannguyen12

@hangfei any temporary solution, while gemini 2.5 flash is not working well as gemini 2.5 pro.

momo-tuannguyen12 avatar Jun 30 '25 03:06 momo-tuannguyen12

@hangfei hello guy, finally I found root cause of the issue. Tool name is duplicated in tools definition. I think we need to validate and raise exception when tool name is duplicated in tools array.

If our code logic is allow sending tool list to model, if a tool name is duplicated, might it will lead the issue I reported above. 500 INTERNAL. {'error': {'code': 500, 'message': 'An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting', 'status': 'INTERNAL'}}

Image

momo-tuannguyen12 avatar Jun 30 '25 04:06 momo-tuannguyen12

facing the same issue

PaveLuchkov avatar Jul 25 '25 07:07 PaveLuchkov

me 2

ShaharKatz avatar Jul 27 '25 17:07 ShaharKatz

me 3

nguyen-tran-ds-vns avatar Jul 29 '25 02:07 nguyen-tran-ds-vns

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.

polong-lin avatar Aug 01 '25 13:08 polong-lin

Again happening.

reachgvm avatar Aug 13 '25 14:08 reachgvm