Skip to content

'A potential loop was detected' error renders Gemini CLI unusable and interrupts legitimate repetitive tasks #8237

Description

@DavidSuarez2025

What happened?

I am constantly receiving the error:
ℹ A potential loop was detected. This can happen due to repetitive tool calls or other model behavior. The request has been halted.

This occurs in all sessions, especially when trying to execute repetitive tasks such as data analysis operations, reading tools, file edits, and any automation process requiring multiple similar actions in a row. Previously, I could perform these tasks without problems, but now the tool has become unusable: I can't do anything, every attempt ends with the error message and the session is halted.

What did you expect to happen?

I expect Gemini CLI to distinguish between real infinite loops and legitimate processes that require repetitive operations, such as data analysis or multiple edits. Right now, it's not possible to use it for any practical purpose.

Client information

• CLI version: [fill in your version]
• Operating System: [fill in your OS]
• Model: gemini-2.5-pro

Login information

No response

Anything else we need to know?

I have reviewed similar issues such as #5761, #5440, and #5085, and the problem continues to occur. It is essential to review and improve the logic for detecting false positive loops, since the tool prevents any real work involving legitimate analysis or automation processes.

Activity

  1. gemini-cli commented on Sep 11, 2025

    @gemini-cli
    Contributor

    The user is reporting that the loop detection is overly aggressive, making the CLI unusable for their workflows. This is a significant bug. I am adding the status/need-information label because the user has not provided the CLI version. The priority has been lowered to P2 until the required information is provided.

  2. DavidSuarez2025 commented on Sep 11, 2025

    @DavidSuarez2025
    Author
  3. DavidSuarez2025 commented on Sep 11, 2025

    @DavidSuarez2025
    Author

    Thank you for triaging this issue. I can confirm the CLI version information:

    CLI Version: 0.4.0

    Given that this version information has now been provided and considering that this issue makes the CLI completely unusable for legitimate repetitive tasks (data analysis, file operations, automation workflows), I would respectfully request that the priority be reconsidered and elevated from P2.

    This bug effectively renders the tool non-functional for many real-world use cases, as any workflow requiring multiple similar operations triggers the false positive loop detection. The impact is severe as it prevents users from completing basic tasks that previously worked without issues.

    Please consider upgrading the priority given the significant impact on core functionality.

  4. SandyTao520 commented on Sep 11, 2025

    @SandyTao520
    Contributor

    Please try latest main by running with npx!

  5. psu1025 commented on Sep 11, 2025

    @psu1025

    I agree with @DavidSuarez2025. I'm doing repetitive tasks, which requires me to rerun the process every time.

    To mitigate this issue, I've put a lot of effort into creating a system with prompts that can manage tasks from where they left off, as my work can be resumed from the point of interruption. I feel that this process shouldn't be necessary.

    Moreover, if a task needs to be processed in a single run, this issue would completely ruin Gemini's usability.

  6. self-assigned this
    on Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority/p2Important but can be addressed in a future release.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions