Skip to content

False Positive Loop Detection During File Move & Import Update Process #5873

Description

@mohamedyaakoubi

What happened?

While using Gemini CLI (v0.1.18) to move multiple component files and update their imports, the CLI incorrectly detected a “potential loop” and halted the request.

This happened during a repetitive but legitimate process:

Search for file references.

Move the file (git mv).

Search for import paths and update them.

The loop detection triggered despite no actual infinite loop occurring. The process was repetitive by nature (due to multiple files being handled), but finite.

Excerpt from session:

ℹ A potential loop was detected. This can happen due to repetitive tool calls or other model behavior. The request has been halted.

Gemini then stated it wasn’t truly stuck but was working through the list systematically.

What did you expect to happen?

The CLI should have allowed the repetitive-but-finite process to continue without prematurely halting due to false loop detection.
If the safeguard is triggered, there should be an option to confirm and continue when the user knows the process is intentional.

Client information

Details

CLI Version 0.1.18
Model gemini-2.5-pro
Sandbox no sandbox
OS win32
Auth Method gemini-api-key
Platform: Windows 10

Login information

No response

Anything else we need to know?

The CLI workflow was sequential and deterministic, not circular.

This behavior slows down bulk refactor operations where repetitive search/move/update patterns are necessary.

Activity

  1. added
    area/coreIssues related to User Interface, OS Support, Core Functionality
    priority/p1Important and should be addressed in the near term.
    on Aug 9, 2025
  2. torronen commented on Aug 16, 2025

    @torronen

    I have similar issue. My case: review a set of source code files.

    "A potential loop was detected. This can happen due to repetitive tool calls or other model behavior. The request has been halted."

  3. cvjxendra commented on Aug 18, 2025

    @cvjxendra

    Same issue here. This is a show stopper.

  4. jjdelorme commented on Aug 26, 2025

    @jjdelorme

    +1 This has happened in multiple repositories and with multiple different scenarios including just running /init for me.

  5. srithreepo commented on Oct 2, 2025

    @srithreepo
    Contributor

    Hi We are actively working on improving these scenarios. Are any of you still running into this? If so do you see these in specific scenarios?

  6. gemini-cli commented on Dec 3, 2025

    @gemini-cli
    Contributor

    Hello! As part of our effort to keep our backlog manageable and focus on the most active issues, we are tidying up older reports.

    It looks like this issue hasn't been active for a while, so we are closing it for now. However, if you are still experiencing this bug on the latest stable build, please feel free to comment on this issue or create a new one with updated details.

    Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stalearea/coreIssues related to User Interface, OS Support, Core Functionalitypriority/p1Important and should be addressed in the near term.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions