Infinite Loop in API Request generation via Gemini AI Studio "Build" feature

Hello,

I am reporting a potential bug regarding the code generated by the “Build” feature in Gemini AI Studio.

Summary of the issue: When using the “Build” feature to generate a functional application, the resulting code logic contains a structural flaw that leads to an unintended infinite loop of API calls.

Steps to reproduce:

  1. Open Gemini AI Studio and select the “Build” feature.

  2. Provide a prompt to generate an application that requires sequential processing.

  3. Upon executing the generated code, the API request logic fails to properly check exit conditions, resulting in continuous, rapid-fire API calls until the execution environment is manually terminated.

Expected behavior: The generated code should include proper exit conditions or rate limiting to prevent uncontrolled API request loops.

Actual behavior: The code generates an infinite loop that continues until an external intervention occurs, which poses a significant risk to execution stability.

I would appreciate it if the technical team could investigate the logic generation process of the “Build” feature and implement a fix for these recurring loop conditions.

Thank you for your support.

Do you experience this loop when using the app in AI Studio or when usign the code generated by the app ?

Yes, that is correct. This issue occurred when I used the code generated by the “Build” feature in Gemini AI Studio. I did not intentionally include any loops; the infinite loop is a result of the logic within the generated code itself.

Can you share the prompt you used via the DM with me
I am working on reproducing this but am unable to do it with my prompts

Issue with Google AI Studio: Google AI Studio

Mustan,

I apologize, but I do not have a record of the exact prompt I used at that time, so I cannot share it directly. However, I can provide a detailed description of the type of application I was trying to create and the API behavior I experienced. If there is any other information that would be helpful for your investigation, please let me know, and I will be happy to provide it.

Hello, Mustan.

Thank you for your ongoing investigation. As I do not have the specific prompt history, I have compiled a summary of the application’s functionality and the technical issues I encountered, along with a video demonstrating the error.

[Summary Table]

Period Issue Cause
Early June Generation state did not reset Inconsistency in generation flag management (isGeneratingRef), causing the generation process to get stuck.
Mid-June Mismatch in generation parameters (video duration) Invalid video durations were selectable, causing API request errors and process termination.
Late June Prompt structure errors leading to re-generation The “7R” prompt template did not match the expected system structure, requiring template revisions.
Late June - Early July Excessive retries on API timeouts The timeout threshold (circuit breaker) for API response delays was incorrectly configured, causing intermittent process termination.

I hope this helps your team identify the root cause. Please let me know if you need any further technical details.